[llvm] r273478 - [MachO] Adding a few missing swapStruct functions

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 22 14:01:17 PDT 2016


Author: cbieneman
Date: Wed Jun 22 16:01:17 2016
New Revision: 273478

URL: http://llvm.org/viewvc/llvm-project?rev=273478&view=rev
Log:
[MachO] Adding a few missing swapStruct functions

These are just missing swap functions for handling endian conversion.

Modified:
    llvm/trunk/include/llvm/Support/MachO.h

Modified: llvm/trunk/include/llvm/Support/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.h?rev=273478&r1=273477&r2=273478&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.h (original)
+++ llvm/trunk/include/llvm/Support/MachO.h Wed Jun 22 16:01:17 2016
@@ -960,6 +960,20 @@ namespace llvm {
 
     // Byte order swapping functions for MachO structs
 
+    inline void swapStruct(fat_header &mh) {
+      sys::swapByteOrder(mh.magic);
+      sys::swapByteOrder(mh.nfat_arch);
+    }
+
+    inline void swapStruct(fat_arch &mh) {
+      sys::swapByteOrder(mh.cputype);
+      sys::swapByteOrder(mh.cpusubtype);
+      sys::swapByteOrder(mh.offset);
+      sys::swapByteOrder(mh.size);
+      sys::swapByteOrder(mh.align);
+    }
+
+
     inline void swapStruct(mach_header &mh) {
       sys::swapByteOrder(mh.magic);
       sys::swapByteOrder(mh.cputype);




More information about the llvm-commits mailing list