Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1007)

Unified Diff: src/inspector/v8-debugger-script.cc

Issue 2787713003: PPC/S390: Fix inspector/runtime/es6-module.js test failure due to endianness (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger-script.cc
diff --git a/src/inspector/v8-debugger-script.cc b/src/inspector/v8-debugger-script.cc
index f8dae51812a526c951aee9472ce7eba637e484ee..d151ab821f58c6d872baa37b994bbf7ccbf1f918 100644
--- a/src/inspector/v8-debugger-script.cc
+++ b/src/inspector/v8-debugger-script.cc
@@ -44,7 +44,11 @@ String16 calculateHash(const String16& str) {
size_t sizeInBytes = sizeof(UChar) * str.length();
data = reinterpret_cast<const uint32_t*>(str.characters16());
for (size_t i = 0; i < sizeInBytes / 4; i += 4) {
+#if V8_TARGET_LITTLE_ENDIAN
uint32_t v = data[i];
+#else
+ uint32_t v = (data[i] << 16) | (data[i] >> 16);
+#endif
uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF;
hashes[current] = (hashes[current] + zi[current] * xi) % prime[current];
zi[current] = (zi[current] * random[current]) % prime[current];
@@ -54,7 +58,15 @@ String16 calculateHash(const String16& str) {
uint32_t v = 0;
for (size_t i = sizeInBytes - sizeInBytes % 4; i < sizeInBytes; ++i) {
v <<= 8;
+#if V8_TARGET_LITTLE_ENDIAN
v |= reinterpret_cast<const uint8_t*>(data)[i];
+#else
+ if (i % 2) {
+ v |= reinterpret_cast<const uint8_t*>(data)[i - 1];
+ } else {
+ v |= reinterpret_cast<const uint8_t*>(data)[i + 1];
+ }
+#endif
}
uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF;
hashes[current] = (hashes[current] + zi[current] * xi) % prime[current];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698