From 6d2d2c5f0e508714a7a18b6b18d81b94ac97e896 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 16 Sep 2014 02:39:55 +0000 Subject: [PATCH] b58tobin: Simplify zeromask calculation (fixes bug encountered when compiling with LLVM) --- base58.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base58.c b/base58.c index 998a802..8ee27f9 100644 --- a/base58.c +++ b/base58.c @@ -40,7 +40,7 @@ bool b58tobin(void *bin, size_t *binszp, const char *b58, size_t b58sz) uint32_t c; size_t i, j; uint8_t bytesleft = binsz % 4; - uint32_t zeromask = ~((1 << ((bytesleft ?: 4) * 8)) - 1); + uint32_t zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0; unsigned zerocount = 0; if (!b58sz)