From: Yedidya Feldblum Date: Fri, 24 Feb 2017 22:33:37 +0000 (-0800) Subject: Drop support for gcc 4.7 with byteswap shim X-Git-Tag: v2017.03.06.00~22 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=80430673da1e696f7fcd910cc6a64b7aef2edd8f;p=folly.git Drop support for gcc 4.7 with byteswap shim Summary: [Folly] Drop support for gcc 4.7 with byteswap shim Reviewed By: igorsugak, Orvid Differential Revision: D4610746 fbshipit-source-id: 092cd432c7bda9ca5507d0230b6fcaa43b96c500 --- diff --git a/folly/Bits.h b/folly/Bits.h index 7e59ce30..cb4234c4 100644 --- a/folly/Bits.h +++ b/folly/Bits.h @@ -70,10 +70,6 @@ #include #include -#if FOLLY_HAVE_BYTESWAP_H -# include -#endif - #include #include #include @@ -242,27 +238,6 @@ struct EndianIntBase { static T swap(T x); }; -#ifndef _MSC_VER - -/** - * If we have the bswap_16 macro from byteswap.h, use it; otherwise, provide our - * own definition. - */ -#ifdef bswap_16 -# define our_bswap16 bswap_16 -#else - -template -inline constexpr typename std::enable_if< - sizeof(Int16) == 2, - Int16>::type -our_bswap16(Int16 x) { - return ((x >> 8) & 0xff) | ((x & 0xff) << 8); -} -#endif - -#endif - #define FB_GEN(t, fn) \ template <> \ inline t EndianIntBase::swap(t x) { \ @@ -270,8 +245,7 @@ our_bswap16(Int16 x) { } // fn(x) expands to (x) if the second argument is empty, which is exactly -// what we want for [u]int8_t. Also, gcc 4.7 on Intel doesn't have -// __builtin_bswap16 for some reason, so we have to provide our own. +// what we want for [u]int8_t. FB_GEN( int8_t,) FB_GEN(uint8_t,) #ifdef _MSC_VER @@ -286,8 +260,8 @@ FB_GEN( int64_t, __builtin_bswap64) FB_GEN(uint64_t, __builtin_bswap64) FB_GEN( int32_t, __builtin_bswap32) FB_GEN(uint32_t, __builtin_bswap32) -FB_GEN( int16_t, our_bswap16) -FB_GEN(uint16_t, our_bswap16) +FB_GEN( int16_t, __builtin_bswap16) +FB_GEN(uint16_t, __builtin_bswap16) #endif #undef FB_GEN diff --git a/folly/configure.ac b/folly/configure.ac index f08d6c2f..c73da686 100644 --- a/folly/configure.ac +++ b/folly/configure.ac @@ -160,7 +160,7 @@ AM_PATH_PYTHON # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h features.h inttypes.h limits.h sched.h stdint.h stdlib.h string.h sys/time.h unistd.h mutex.h malloc.h byteswap.h bits/functexcept.h bits/c++config.h]) +AC_CHECK_HEADERS([fcntl.h features.h inttypes.h limits.h sched.h stdint.h stdlib.h string.h sys/time.h unistd.h mutex.h malloc.h bits/functexcept.h bits/c++config.h]) AC_CHECK_HEADER(double-conversion/double-conversion.h, [], [AC_MSG_ERROR( [Couldn't find double-conversion.h, please download from \