]> granicus.if.org Git - llvm/commitdiff
[MachO] Adding a few missing swapStruct functions
authorChris Bieneman <beanz@apple.com>
Wed, 22 Jun 2016 21:01:17 +0000 (21:01 +0000)
committerChris Bieneman <beanz@apple.com>
Wed, 22 Jun 2016 21:01:17 +0000 (21:01 +0000)
These are just missing swap functions for handling endian conversion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273478 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/MachO.h

index 7881f730380179775946703705fbf99789cdf6d7..dd885eaf08361aa6636996c4ab62ee2de19a52e0 100644 (file)
@@ -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);