mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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>
This commit is contained in:
1 parent
5e1976e37c
commit
51c8bc8abc
1 file changed
+1
-8
+1
-8
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user