Skip to content

Commit 3d93f06

Browse files
committed
fixup!: ternary
1 parent 6875893 commit 3d93f06

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

deps/nbytes/src/nbytes.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +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-
auto v = x + '0';
162-
if (x > 9) {
163-
v += 'a' - '0' - 10;
164-
}
165-
return v;
161+
uint8_t add = (x >= 10) ? ('a' - 10) : '0';
162+
return x + add;
166163
}
167164

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

0 commit comments

Comments
 (0)