From: Chris Bieneman Date: Wed, 22 Jun 2016 21:01:17 +0000 (+0000) Subject: [MachO] Adding a few missing swapStruct functions X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57b5696e1a186050b89210f0bfb0b800e1b540b6;p=llvm [MachO] Adding a few missing swapStruct functions 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 --- diff --git a/include/llvm/Support/MachO.h b/include/llvm/Support/MachO.h index 7881f730380..dd885eaf083 100644 --- a/include/llvm/Support/MachO.h +++ b/include/llvm/Support/MachO.h @@ -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);