summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-06-11 11:12:48 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-06-11 11:12:48 +0200
commit5a0087c5321f89ba48c7a5d664a728bec407c06a (patch)
tree037df3fec77cdde516868e0f9acdefd9f175f45e
parent9e3f489356e93bf3551213585a9033ca36c61510 (diff)
downloadkit-5a0087c5321f89ba48c7a5d664a728bec407c06a.zip
Fix bigint base32
-rw-r--r--source/kit/bigint.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/source/kit/bigint.h b/source/kit/bigint.h
index 0347108..89610f4 100644
--- a/source/kit/bigint.h
+++ b/source/kit/bigint.h
@@ -480,7 +480,7 @@ static kit_bigint_t kit_bi_from_hex(kit_str_t hex) {
return z;
}
-static u8 KIT_BASE32_DIGITS[] = {
+static u8 KIT_BASE32_DIGITS[256] = {
['1'] = 0, ['2'] = 1, ['3'] = 2, ['4'] = 3, ['5'] = 4,
['6'] = 5, ['7'] = 6, ['8'] = 7, ['9'] = 8, ['a'] = 9,
['b'] = 10, ['c'] = 11, ['d'] = 12, ['e'] = 13, ['f'] = 14,
@@ -491,12 +491,9 @@ static u8 KIT_BASE32_DIGITS[] = {
};
static u8 kit_base32_digit(c8 c) {
- assert(c >= '\0' && c < (c8) sizeof KIT_BASE32_DIGITS);
assert(c == '1' || KIT_BASE32_DIGITS[(size_t) (u8) c] != 0);
- return c >= '\0' && c < (c8) sizeof KIT_BASE32_DIGITS
- ? KIT_BASE32_DIGITS[(size_t) (u8) c]
- : 0;
+ return KIT_BASE32_DIGITS[(size_t) (u8) c];
}
static kit_bigint_t kit_bi_from_base32(kit_str_t base32) {