MCPcopy Create free account
hub / github.com/cwida/ALP / ReadValue

Method ReadValue

publication/source_code/include/chimp/byte_reader.hpp:91–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89
90template <>
91inline uint32_t ByteReader::ReadValue(uint8_t bytes, uint8_t trailing_zero) {
92 uint32_t result = 0;
93 switch (bytes) {
94 case 0:
95 if (trailing_zero < 8) {
96 result = Load<uint32_t>(buffer + index);
97 index += sizeof(uint32_t);
98 return result;
99 }
100 return result;
101 case 1:
102 result = Load<uint8_t>(buffer + index);
103 index++;
104 return result;
105 case 2:
106 result = Load<uint16_t>(buffer + index);
107 index += 2;
108 return result;
109 case 3:
110 memcpy(&result, (void*)(buffer + index), 3);
111 index += 3;
112 return result;
113 case 4:
114 result = Load<uint32_t>(buffer + index);
115 index += 4;
116 return result;
117 default:
118 throw InternalException("Write of %llu bytes attempted into address pointing to 4 byte value", bytes);
119 }
120}
121} // namespace alp_bench

Callers

nothing calls this directly

Calls 1

InternalExceptionClass · 0.85

Tested by

no test coverage detected