1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 * 6 * Copyright (c) 2018 Andrey Semashev 7 */ 8 /*! 9 * \file atomic/detail/string_ops.hpp 10 * 11 * This header defines string operations for Boost.Atomic 12 */ 13 14 #ifndef BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_ 15 #define BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_ 16 17 #include <boost/atomic/detail/config.hpp> 18 19 #ifdef BOOST_HAS_PRAGMA_ONCE 20 #pragma once 21 #endif 22 23 #if defined(__has_builtin) 24 #if __has_builtin(__builtin_memcpy) 25 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY 26 #endif 27 #if __has_builtin(__builtin_memcmp) 28 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP 29 #endif 30 #if __has_builtin(__builtin_memset) 31 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET 32 #endif 33 #elif defined(BOOST_GCC) 34 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY 35 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP 36 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET 37 #endif 38 39 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) 40 #define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy 41 #else 42 #define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy 43 #endif 44 45 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) 46 #define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp 47 #else 48 #define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp 49 #endif 50 51 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET) 52 #define BOOST_ATOMIC_DETAIL_MEMSET __builtin_memset 53 #else 54 #define BOOST_ATOMIC_DETAIL_MEMSET std::memset 55 #endif 56 57 #if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET) 58 #include <cstring> 59 #endif 60 61 #endif // BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_ 62