summaryrefslogtreecommitdiff
path: root/src/util-inl.h
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-12-15 12:57:49 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-12-15 16:37:10 +0100
commitf176b31e749d0a692431940e44fd8b16fca75620 (patch)
tree9c8bd76d967e3f7735bf3bbf590e8ebc49deafdd /src/util-inl.h
parentce2471673fdba3fddea728c0659b9c14230fa008 (diff)
downloadnode-new-f176b31e749d0a692431940e44fd8b16fca75620.tar.gz
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: https://github.com/nodejs/node/issues/4284 PR-URL: https://github.com/nodejs/node/pull/4290 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/util-inl.h')
-rw-r--r--src/util-inl.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/util-inl.h b/src/util-inl.h
index 669b7e7535..69dc5b2a61 100644
--- a/src/util-inl.h
+++ b/src/util-inl.h
@@ -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
- }
}