From 1a3785b711da20679f685db5c8f1fa0a1112a62b Mon Sep 17 00:00:00 2001 From: hellerve Date: Thu, 27 Jul 2017 15:23:49 -0400 Subject: [PATCH] we dont need to mask if we're going to shift anyway --- nibble.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nibble.c b/nibble.c index c6caa9f..e7f4a6c 100644 --- a/nibble.c +++ b/nibble.c @@ -54,7 +54,7 @@ uint64_t bcd_to_64(bcd x) { for (i = 0; i < 10; ++i) { res *= 100; - res += ((x.internal[i] & 0xf0) >> 4) * 10; + res += (x.internal[i] >> 4) * 10; res += (x.internal[i] & 0xf); } @@ -68,7 +68,7 @@ char* bcd_to_string(bcd x) { char* res = malloc(n+1); for (i = 0; i < n; i+=2, to++) { - res[i] = ((x.internal[to] & 0xf0) >> 4) + '0'; + res[i] = (x.internal[to] >> 4) + '0'; res[i+1] = (x.internal[to] & 0xf) + '0'; }