]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lld/ELF/Bits.h
MFC r355070:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lld / ELF / Bits.h
1 //===- Bits.h ---------------------------------------------------*- C++ -*-===//
2 //
3 //                             The LLVM Linker
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLD_ELF_BITS_H
11 #define LLD_ELF_BITS_H
12
13 #include "Config.h"
14 #include "llvm/Support/Endian.h"
15
16 namespace lld {
17 namespace elf {
18
19 inline uint64_t readUint(uint8_t *Buf) {
20   if (Config->Is64)
21     return llvm::support::endian::read64(Buf, Config->Endianness);
22   return llvm::support::endian::read32(Buf, Config->Endianness);
23 }
24
25 inline void writeUint(uint8_t *Buf, uint64_t Val) {
26   if (Config->Is64)
27     llvm::support::endian::write64(Buf, Val, Config->Endianness);
28   else
29     llvm::support::endian::write32(Buf, Val, Config->Endianness);
30 }
31
32 } // namespace elf
33 } // namespace lld
34
35 #endif