Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Bjornson <zbbjornson@gmail.com>2016-09-22 04:02:45 +0300
committerGibson Fahnestock <gib@uk.ibm.com>2016-10-04 11:28:18 +0300
commit7420835390bcf44696349fad0498390959816acd (patch)
tree3078395df358abc1cf68151139ed82cc4ff1c61f /src/util.h
parentd33c4bf97b68dbae83a1d456f7b34a91b1583666 (diff)
src: fix build for older clang
Removes use of builtins that are unavailable for older clang. Per benchmarks, only uses builtins on Windows, where speedup is significant. Also adds test for unaligned ucs2 buffer write. Between #3410 and #7645, bytes were swapped twice on bigendian platforms if buffer was not two-byte aligned. See comment in #7645. PR-URL: https://github.com/nodejs/node/pull/7645 Fixes: https://github.com/nodejs/node/issues/7618 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util.h b/src/util.h
index 25f2eb01783..e2f9df02bc4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -254,7 +254,11 @@ inline void ClearWrap(v8::Local<v8::Object> object);
template <typename TypeName>
inline TypeName* Unwrap(v8::Local<v8::Object> object);
-inline void SwapBytes(uint16_t* dst, const uint16_t* src, size_t buflen);
+// Swaps bytes in place. nbytes is the number of bytes to swap and must be a
+// multiple of the word size (checked by function).
+inline void SwapBytes16(char* data, size_t nbytes);
+inline void SwapBytes32(char* data, size_t nbytes);
+inline void SwapBytes64(char* data, size_t nbytes);
// tolower() is locale-sensitive. Use ToLower() instead.
inline char ToLower(char c);