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

Unified Diff: src/wasm/function-body-decoder.h

Issue 2639353002: [wasm] Fix I32ReinterpretF32 and I64ReinterpretF64 on ia32. (Closed)
Patch Set: use memcpy instead of reinterpret_cast Created 3 years, 11 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 | « src/compiler/instruction.h ('k') | src/wasm/wasm-interpreter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/function-body-decoder.h
diff --git a/src/wasm/function-body-decoder.h b/src/wasm/function-body-decoder.h
index 836dda4b44a9c4408f85aab006237cc6d30e2e3a..b4faf576d39fbc5cce219cad80099bfc6818c8ca 100644
--- a/src/wasm/function-body-decoder.h
+++ b/src/wasm/function-body-decoder.h
@@ -70,7 +70,9 @@ struct ImmF32Operand {
float value;
unsigned length;
inline ImmF32Operand(Decoder* decoder, const byte* pc) {
- value = bit_cast<float>(decoder->checked_read_u32(pc, 1, "immf32"));
+ // Avoid bit_cast because it might not preserve the signalling bit of a NaN.
+ uint32_t tmp = decoder->checked_read_u32(pc, 1, "immf32");
+ memcpy(&value, &tmp, sizeof(value));
length = 4;
}
};
@@ -79,7 +81,9 @@ struct ImmF64Operand {
double value;
unsigned length;
inline ImmF64Operand(Decoder* decoder, const byte* pc) {
- value = bit_cast<double>(decoder->checked_read_u64(pc, 1, "immf64"));
+ // Avoid bit_cast because it might not preserve the signalling bit of a NaN.
+ uint64_t tmp = decoder->checked_read_u64(pc, 1, "immf64");
+ memcpy(&value, &tmp, sizeof(value));
length = 8;
}
};
« no previous file with comments | « src/compiler/instruction.h ('k') | src/wasm/wasm-interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698