summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-03-02 21:19:12 +0000
committerRui Ueyama <ruiu@google.com>2015-03-02 21:19:12 +0000
commit3206b79d53e60988c3dc3f3f2480b7d214c4f152 (patch)
tree25a2662cd16c80b7a616d8141688e9c185b98184 /llvm/lib/Support/Path.cpp
parenta6d7acc09e4e69d5d1f325e8ab9ed369c08f8137 (diff)
downloadbcm5719-llvm-3206b79d53e60988c3dc3f3f2480b7d214c4f152.tar.gz
bcm5719-llvm-3206b79d53e60988c3dc3f3f2480b7d214c4f152.zip
Use read{16,32,64}{le,be}() instead of *reinterpret_cast<u{little,big}{16,32,64}_t>().
llvm-svn: 231016
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index a11bb7feea0..8ffbb185ac0 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -30,6 +30,7 @@
#endif
using namespace llvm;
+using namespace llvm::support::endian;
namespace {
using llvm::StringRef;
@@ -917,7 +918,7 @@ file_magic identify_magic(StringRef Magic) {
if (Magic.size() < MinSize)
return file_magic::coff_import_library;
- int BigObjVersion = *reinterpret_cast<const support::ulittle16_t*>(
+ int BigObjVersion = read16le(
Magic.data() + offsetof(COFF::BigObjHeader, Version));
if (BigObjVersion < COFF::BigObjHeader::MinBigObjectVersion)
return file_magic::coff_import_library;
@@ -1034,8 +1035,7 @@ file_magic identify_magic(StringRef Magic) {
case 'M': // Possible MS-DOS stub on Windows PE file
if (Magic[1] == 'Z') {
- uint32_t off =
- *reinterpret_cast<const support::ulittle32_t*>(Magic.data() + 0x3c);
+ uint32_t off = read32le(Magic.data() + 0x3c);
// PE/COFF file, either EXE or DLL.
if (off < Magic.size() &&
memcmp(Magic.data()+off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0)
OpenPOWER on IntegriCloud