Home | History | Annotate | Download | only in base

Lines Matching refs:memory

26 // Reading and writing of little and big-endian numbers from memory
30 inline void Set8(void* memory, size_t offset, uint8 v) {
31 static_cast<uint8*>(memory)[offset] = v;
34 inline uint8 Get8(const void* memory, size_t offset) {
35 return static_cast<const uint8*>(memory)[offset];
38 inline void SetBE16(void* memory, uint16 v) {
39 Set8(memory, 0, static_cast<uint8>(v >> 8));
40 Set8(memory, 1, static_cast<uint8>(v >> 0));
43 inline void SetBE32(void* memory, uint32 v) {
44 Set8(memory, 0, static_cast<uint8>(v >> 24));
45 Set8(memory, 1, static_cast<uint8>(v >> 16));
46 Set8(memory, 2, static_cast<uint8>(v >> 8));
47 Set8(memory, 3, static_cast<uint8>(v >> 0));
50 inline void SetBE64(void* memory, uint64 v) {
51 Set8(memory, 0, static_cast<uint8>(v >> 56));
52 Set8(memory, 1, static_cast<uint8>(v >> 48));
53 Set8(memory, 2, static_cast<uint8>(v >> 40));
54 Set8(memory, 3, static_cast<uint8>(v >> 32));
55 Set8(memory, 4, static_cast<uint8>(v >> 24));
56 Set8(memory, 5, static_cast<uint8>(v >> 16));
57 Set8(memory, 6, static_cast<uint8>(v >> 8));
58 Set8(memory, 7, static_cast<uint8>(v >> 0));
61 inline uint16 GetBE16(const void* memory) {
62 return static_cast<uint16>((Get8(memory, 0) << 8) |
63 (Get8(memory, 1) << 0));
66 inline uint32 GetBE32(const void* memory) {
67 return (static_cast<uint32>(Get8(memory, 0)) << 24) |
68 (static_cast<uint32>(Get8(memory, 1)) << 16) |
69 (static_cast<uint32>(Get8(memory, 2)) << 8) |
70 (static_cast<uint32>(Get8(memory, 3)) << 0);
73 inline uint64 GetBE64(const void* memory) {
74 return (static_cast<uint64>(Get8(memory, 0)) << 56) |
75 (static_cast<uint64>(Get8(memory, 1)) << 48) |
76 (static_cast<uint64>(Get8(memory, 2)) << 40) |
77 (static_cast<uint64>(Get8(memory, 3)) << 32) |
78 (static_cast<uint64>(Get8(memory, 4)) << 24) |
79 (static_cast<uint64>(Get8(memory, 5)) << 16) |
80 (static_cast<uint64>(Get8(memory, 6)) << 8) |
81 (static_cast<uint64>(Get8(memory, 7)) << 0);
84 inline void SetLE16(void* memory, uint16 v) {
85 Set8(memory, 0, static_cast<uint8>(v >> 0));
86 Set8(memory, 1, static_cast<uint8>(v >> 8));
89 inline void SetLE32(void* memory, uint32 v) {
90 Set8(memory, 0, static_cast<uint8>(v >> 0));
91 Set8(memory, 1, static_cast<uint8>(v >> 8));
92 Set8(memory, 2, static_cast<uint8>(v >> 16));
93 Set8(memory, 3, static_cast<uint8>(v >> 24));
96 inline void SetLE64(void* memory, uint64 v) {
97 Set8(memory, 0, static_cast<uint8>(v >> 0));
98 Set8(memory, 1, static_cast<uint8>(v >> 8));
99 Set8(memory, 2, static_cast<uint8>(v >> 16));
100 Set8(memory, 3, static_cast<uint8>(v >> 24));
101 Set8(memory, 4, static_cast<uint8>(v >> 32));
102 Set8(memory, 5, static_cast<uint8>(v >> 40));
103 Set8(memory, 6, static_cast<uint8>(v >> 48));
104 Set8(memory, 7, static_cast<uint8>(v >> 56));
107 inline uint16 GetLE16(const void* memory) {
108 return static_cast<uint16>((Get8(memory, 0) << 0) |
109 (Get8(memory, 1) << 8));
112 inline uint32 GetLE32(const void* memory) {
113 return (static_cast<uint32>(Get8(memory, 0)) << 0) |
114 (static_cast<uint32>(Get8(memory, 1)) << 8) |
115 (static_cast<uint32>(Get8(memory, 2)) << 16) |
116 (static_cast<uint32>(Get8(memory, 3)) << 24);
119 inline uint64 GetLE64(const void* memory) {
120 return (static_cast<uint64>(Get8(memory, 0)) << 0) |
121 (static_cast<uint64>(Get8(memory, 1)) << 8) |
122 (static_cast<uint64>(Get8(memory, 2)) << 16) |
123 (static_cast<uint64>(Get8(memory, 3)) << 24) |
124 (static_cast<uint64>(Get8(memory, 4)) << 32) |
125 (static_cast<uint64>(Get8(memory, 5)) << 40) |
126 (static_cast<uint64>(Get8(memory, 6)) << 48) |
127 (static_cast<uint64>(Get8(memory, 7)) << 56);