MCPcopy Create free account
hub / github.com/attermann/microReticulum / hexFromByte

Method hexFromByte

src/microReticulum/Bytes.cpp:183–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181const char hex_lower_chars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
182
183std::string RNS::hexFromByte(uint8_t byte, bool upper /*= true*/) {
184 std::string hex;
185 if (upper) {
186 hex += hex_upper_chars[ (byte& 0xF0) >> 4];
187 hex += hex_upper_chars[ (byte& 0x0F) >> 0];
188 }
189 else {
190 hex += hex_lower_chars[ (byte& 0xF0) >> 4];
191 hex += hex_lower_chars[ (byte& 0x0F) >> 0];
192 }
193 return hex;
194}
195
196std::string Bytes::toHex(bool upper /*= false*/) const {
197 if (!_data) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected