musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/misc/a64l.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/a64l.c')
-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)
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月14日 07:31:42 +0000

AltStyle によって変換されたページ (->オリジナル) /