ROSE  0.9.9.139
ByteOrder.h
1 #ifndef ROSE_ByteOrder_H
2 #define ROSE_ByteOrder_H
3 
4 namespace ByteOrder {
5 
6 // Caution: the symbols LITTLE_ENDIAN and BIG_ENDIAN are already defined on some systems, so we use other names in ROSE.
7 enum Endianness {
8  ORDER_UNSPECIFIED=0,
9  ORDER_LSB,
10  ORDER_MSB
11 };
12 
14 Endianness host_order();
15 
17 void convert(void *bytes_, size_t nbytes, Endianness from, Endianness to);
18 
21 int8_t swap_bytes(int8_t n);
22 uint8_t swap_bytes(uint8_t n);
23 int16_t swap_bytes(int16_t n);
24 uint16_t swap_bytes(uint16_t n);
25 int32_t swap_bytes(int32_t n);
26 uint32_t swap_bytes(uint32_t n);
27 int64_t swap_bytes(int64_t n);
28 uint64_t swap_bytes(uint64_t n);
33 int8_t le_to_host(int8_t n);
34 uint8_t le_to_host(uint8_t n);
35 int16_t le_to_host(int16_t n);
36 uint16_t le_to_host(uint16_t n);
37 int32_t le_to_host(int32_t n);
38 uint32_t le_to_host(uint32_t n);
39 int64_t le_to_host(int64_t n);
40 uint64_t le_to_host(uint64_t n);
45 void host_to_le(unsigned h, uint8_t *n);
46 void host_to_le(unsigned h, uint16_t *n);
47 void host_to_le(unsigned h, uint32_t *n);
48 void host_to_le(rose_addr_t h, uint64_t *n);
49 void host_to_le(rose_rva_t h, uint32_t *n);
50 void host_to_le(rose_rva_t h, uint64_t *n);
51 void host_to_le(int h, int8_t *n);
52 void host_to_le(int h, int16_t *n);
53 void host_to_le(int h, int32_t *n);
54 void host_to_le(int64_t h, int64_t *n);
59 uint8_t be_to_host(uint8_t n);
60 uint16_t be_to_host(uint16_t n);
61 uint32_t be_to_host(uint32_t n);
62 uint64_t be_to_host(uint64_t n);
63 int8_t be_to_host(int8_t n);
64 int16_t be_to_host(int16_t n);
65 int32_t be_to_host(int32_t n);
66 int64_t be_to_host(int64_t n);
71 void host_to_be(unsigned h, uint8_t *n);
72 void host_to_be(unsigned h, uint16_t *n);
73 void host_to_be(unsigned h, uint32_t *n);
74 void host_to_be(rose_addr_t h, uint64_t *n);
75 void host_to_be(rose_rva_t h, uint32_t *n);
76 void host_to_be(rose_rva_t h, uint64_t *n);
77 void host_to_be(int h, int8_t *n);
78 void host_to_be(int h, int16_t *n);
79 void host_to_be(int h, int32_t *n);
80 void host_to_be(int64_t h, int64_t *n);
85 uint8_t disk_to_host(Endianness sex, uint8_t n);
86 uint16_t disk_to_host(Endianness sex, uint16_t n);
87 uint32_t disk_to_host(Endianness sex, uint32_t n);
88 uint64_t disk_to_host(Endianness sex, uint64_t n);
89 int8_t disk_to_host(Endianness sex, int8_t n);
90 int16_t disk_to_host(Endianness sex, int16_t n);
91 int32_t disk_to_host(Endianness sex, int32_t n);
92 int64_t disk_to_host(Endianness sex, int64_t n);
93 
95 void host_to_disk(Endianness sex, unsigned h, uint8_t *np);
96 void host_to_disk(Endianness sex, unsigned h, uint16_t *np);
97 void host_to_disk(Endianness sex, unsigned h, uint32_t *np);
98 void host_to_disk(Endianness sex, rose_addr_t h, uint64_t *np);
99 void host_to_disk(Endianness sex, rose_rva_t h, uint64_t *np);
100 void host_to_disk(Endianness sex, int h, int8_t *np);
101 void host_to_disk(Endianness sex, int h, int16_t *np);
102 void host_to_disk(Endianness sex, int h, int32_t *np);
103 void host_to_disk(Endianness sex, int64_t h, int64_t *np);
106 } // namespace
107 #endif
A relative virtual address optionally associated with a SgAsmSection.
Definition: Cxx_Grammar.h:6819