From ac89e4411133a32f5ceb81d6c71efd15f08400d0 Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Thu, 5 Jun 2014 01:01:23 -0400 Subject: [PATCH] Added support for binary string interpretation in strtoi variants when using the 0b prefix. --- Jupiter/Functions.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Jupiter/Functions.c b/Jupiter/Functions.c index b8d7226..d993209 100644 --- a/Jupiter/Functions.c +++ b/Jupiter/Functions.c @@ -634,6 +634,11 @@ unsigned int strtoui_nospace(const char *str, int base) str++; base = 16; } + else if (*str == 'b' || *str == 'B') + { + str++; + base = 2; + } else base = 8; } else base = 10; @@ -753,6 +758,12 @@ unsigned int strtoui_nospace_s(const char *str, size_t length, int base) str++; base = 16; } + else if (*str == 'b' || *str == 'B') + { + if (--length == 0) return total; + str++; + base = 2; + } else base = 8; } else base = 10;