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