From ba80b5d43c516a6136897f5db37b90f75a62f4be Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Sun, 28 Sep 2014 00:22:27 +0000 Subject: [PATCH] WinCOFFObjectWriter.cpp: make write_uint32_le more efficient llvm-svn: 218574 --- llvm/lib/MC/WinCOFFObjectWriter.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp index f40e1abb048e..5ffa107da9af 100644 --- a/llvm/lib/MC/WinCOFFObjectWriter.cpp +++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp @@ -28,6 +28,7 @@ #include "llvm/MC/MCValue.h" #include "llvm/Support/COFF.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/Endian.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/TimeValue.h" #include @@ -196,12 +197,9 @@ public: }; } -static inline void write_uint32_le(void *Data, uint32_t const &Value) { - uint8_t *Ptr = reinterpret_cast(Data); - Ptr[0] = (Value & 0x000000FF) >> 0; - Ptr[1] = (Value & 0x0000FF00) >> 8; - Ptr[2] = (Value & 0x00FF0000) >> 16; - Ptr[3] = (Value & 0xFF000000) >> 24; +static inline void write_uint32_le(void *Data, uint32_t Value) { + support::endian::write(Data, + Value); } //------------------------------------------------------------------------------