Chromium Code Reviews| 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..56df26759b0a48a1e5a46208a435422fcb2e4733 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")); |
| + // Do not use bit_cast to preserve a potential signalling bit of a NaN. |
|
titzer
2017/01/19 13:13:01
Comment is a little misleading (since it might be
ahaas
2017/01/19 15:46:19
Done.
|
| + uint32_t tmp = decoder->checked_read_u32(pc, 1, "immf32"); |
| + value = *reinterpret_cast<float*>(&tmp); |
| 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")); |
| + // Do not use bit_cast to preserve a potential signalling bit of a NaN. |
| + uint64_t tmp = decoder->checked_read_u64(pc, 1, "immf64"); |
| + value = *reinterpret_cast<double*>(&tmp); |
| length = 8; |
| } |
| }; |