Skip to content

Commit 61f4ecb

Browse files
authored
fixup!: more clear code
1 parent e65cb9e commit 61f4ecb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/nbytes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ const int8_t unhex_table[256] = {
158158
-1, -1, -1, -1, -1, -1, -1, -1, -1};
159159

160160
inline constexpr char nibble(uint8_t x) {
161-
return x + '0' + ((x > 9) * 39);
161+
uint8_t add = (x >= 10) ? ('a' - 10) : '0';
162+
return x + add;
162163
}
163164

164165
size_t HexEncode(const char *src, size_t slen, char *dst, size_t dlen) {

0 commit comments

Comments
 (0)