Skip to content
Snippets Groups Projects
Commit d61a91fa authored by Ludwig Knüpfer's avatar Ludwig Knüpfer
Browse files

Merge pull request #2170 from LudwigOrtmann/native-bswap

native: workaround for missing __builtin_bswap16
parents e291ae46 093085b4
No related branches found
No related tags found
No related merge requests found
...@@ -95,6 +95,11 @@ all-gprof: export LINKFLAGS += -pg ...@@ -95,6 +95,11 @@ all-gprof: export LINKFLAGS += -pg
export INCLUDES += $(NATIVEINCLUDES) export INCLUDES += $(NATIVEINCLUDES)
# workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
ifneq ($(shell gcc --version | head -1 | grep -E ' (4.6|4.7)'),)
export CFLAGS += -DHAVE_NO_BUILTIN_BSWAP16
endif
# backward compatability with glibc <= 2.17 for native # backward compatability with glibc <= 2.17 for native
ifeq ($(CPU),native) ifeq ($(CPU),native)
ifeq ($(shell uname -s),Linux) ifeq ($(shell uname -s),Linux)
......
...@@ -275,6 +275,12 @@ static inline uint64_t NTOHLL(uint64_t v); ...@@ -275,6 +275,12 @@ static inline uint64_t NTOHLL(uint64_t v);
/* **************************** IMPLEMENTATION ***************************** */ /* **************************** IMPLEMENTATION ***************************** */
#ifdef HAVE_NO_BUILTIN_BSWAP16
static inline unsigned short __builtin_bswap16(unsigned short a)
{
return (a<<8)|(a>>8);
}
#endif
static inline uint16_t byteorder_swaps(uint16_t v) static inline uint16_t byteorder_swaps(uint16_t v)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment