From dfcf175de8cd89d8379c2a561482f70c605d5093 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 8 Aug 2019 09:46:59 -0400 Subject: fix size comparison to proper order --- binary.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binary.h b/binary.h index 9046396..2721e9b 100644 --- a/binary.h +++ b/binary.h @@ -5,9 +5,9 @@ #define BIT_UINTMAXBITS (sizeof(uintmax_t) * CHAR_BIT) #define BIN_BIT(_s, _b) (\ - sizeof(_s) > (_b + 1) || (_b + 1) > BIT_UINTMAXBITS ? \ + sizeof(_s) < (_b + 2) || (_b + 2) > BIT_UINTMAXBITS ? \ (uintmax_t)0 : \ - _s[sizeof(_s)-(_b+1)] == '0' ? \ + _s[sizeof(_s)-(_b+2)] == '0' ? \ (uintmax_t)0 : \ (uintmax_t)1 << _b\ ) -- cgit v1.2.1