summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <daniel@octaforge.org>2022-12-31 14:19:43 +0100
committerTimo Teräs <timo.teras@iki.fi>2023-01-17 15:11:24 +0000
commitc712919a796eeae6e1d85175b22edf3d362deb25 (patch)
treefe08e16e53650dab8525c44e099d8fb29d35738b
parentfeb39beb4bb8cb9b126715983cbd9c5f6433efae (diff)
downloadapk-tools-c712919a796eeae6e1d85175b22edf3d362deb25.tar.gz
apk-tools-c712919a796eeae6e1d85175b22edf3d362deb25.tar.bz2
apk-tools-c712919a796eeae6e1d85175b22edf3d362deb25.tar.xz
apk-tools-c712919a796eeae6e1d85175b22edf3d362deb25.zip
apk_defines: use unsigned operand in BIT
This fixes undefined behavior at least in database, where BIT is used with 31 (as APK_MAX_REPOS is 32) which is not representable with a signed integer.
-rw-r--r--src/apk_defines.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/apk_defines.h b/src/apk_defines.h
index 93cc191..d7c15fb 100644
--- a/src/apk_defines.h
+++ b/src/apk_defines.h
@@ -17,7 +17,7 @@
#include <time.h>
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#define BIT(x) (1 << (x))
+#define BIT(x) (1U << (x))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))