]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
c.h: fix compiler warning [-Werror=shift-count-overflow]
authorKarel Zak <kzak@redhat.com>
Tue, 17 Jan 2023 15:36:13 +0000 (16:36 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Jan 2023 15:40:03 +0000 (16:40 +0100)
It's probably typo in the original path (too many brackets:-)). Let's
be explicit about the types used in the calculation. '1 << n' means
the left shift is on 'int', but we need '(t)1 << n'.

Addresses: e53463ea40c58a6f84a597966ac69be9be72cd7d
Signed-off-by: Karel Zak <kzak@redhat.com>
include/c.h

index 0f25fb009da875a404e446ed47c4b144d612dc07..1fa2dc766f38e9219df48c7c4f6ede045e00e035 100644 (file)
@@ -526,6 +526,6 @@ static inline void print_features(const char **features, const char *prefix)
 # define MAP_ANONYMOUS  (MAP_ANON)
 #endif
 
-#define SINT_MAX(t) ((t) (1 << (sizeof(t) * 8 - 2)) - 1 + ((t) 1 << (sizeof(t) * 8 - 2)))
+#define SINT_MAX(t) (((t)1 << (sizeof(t) * 8 - 2)) - (t)1 + ((t)1 << (sizeof(t) * 8 - 2)))
 
 #endif /* UTIL_LINUX_C_H */