Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src: remove __builtin_bswap16 call
Not supported by apple-gcc and I'm not convinced it's worth adding more
preprocessor hacks when it should be easy as pie for the compiler to
to optimize the byteswap.  If it doesn't, fix the compiler.

Fixes: #4284
PR-URL: #4290
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
bnoordhuis committed Dec 15, 2015
commit f176b31e749d0a692431940e44fd8b16fca75620
9 changes: 1 addition & 8 deletions src/util-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,8 @@ TypeName* Unwrap(v8::Local<v8::Object> object) {
}

void SwapBytes(uint16_t* dst, const uint16_t* src, size_t buflen) {
for (size_t i = 0; i < buflen; i++) {
// __builtin_bswap16 generates more efficient code with
// g++ 4.8 on PowerPC and other big-endian archs
#ifdef __GNUC__
dst[i] = __builtin_bswap16(src[i]);
#else
for (size_t i = 0; i < buflen; i += 1)
dst[i] = (src[i] << 8) | (src[i] >> 8);
#endif
}
}


Expand Down