File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 21
21
#include " mlir/Target/Wasm/WasmImporter.h"
22
22
#include " llvm/Support/Debug.h"
23
23
#include " llvm/Support/DebugLog.h"
24
+ #include " llvm/Support/Endian.h"
24
25
#include " llvm/Support/FormatVariadic.h"
25
26
#include " llvm/Support/LEB128.h"
26
27
#include " llvm/Support/LogicalResult.h"
@@ -613,19 +614,17 @@ FailureOr<float> ParserHead::parseLiteral<float>() {
613
614
FailureOr<StringRef> bytes = consumeNBytes (4 );
614
615
if (failed (bytes))
615
616
return failure ();
616
- float result;
617
- std::memcpy (&result, bytes->bytes_begin (), 4 );
618
- return result;
617
+ return llvm::support::endian::read<float >(bytes->bytes_begin (),
618
+ llvm::endianness::little);
619
619
}
620
620
621
621
template <>
622
622
FailureOr<double > ParserHead::parseLiteral<double >() {
623
623
FailureOr<StringRef> bytes = consumeNBytes (8 );
624
624
if (failed (bytes))
625
625
return failure ();
626
- double result;
627
- std::memcpy (&result, bytes->bytes_begin (), 8 );
628
- return result;
626
+ return llvm::support::endian::read<double >(bytes->bytes_begin (),
627
+ llvm::endianness::little);
629
628
}
630
629
631
630
template <>
You can’t perform that action at this time.
0 commit comments