diff options
-rw-r--r-- | src/misc/a64l.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/misc/a64l.c b/src/misc/a64l.c index 86aeefe0..60557710 100644 --- a/src/misc/a64l.c +++ b/src/misc/a64l.c @@ -9,9 +9,12 @@ long a64l(const char *s) { int e; uint32_t x = 0; - for (e=0; e<36 && *s; e+=6, s++) - x |= (strchr(digits, *s)-digits)<<e; - return x; + for (e=0; e<36 && *s; e+=6, s++) { + const char *d = strchr(digits, *s); + if (!d) break; + x |= (uint32_t)(d-digits)<<e; + } + return (int32_t)x; } char *l64a(long x0) |