we dont need to mask if we're going to shift anyway

This commit is contained in:
2017-07-27 15:23:49 -04:00
parent 9ed432fbd5
commit 1a3785b711

View File

@@ -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';
}