From bbfb132ccb9d533aa3175d0360cca5df31c18c9e Mon Sep 17 00:00:00 2001 From: JustinAJ Date: Thu, 5 Jun 2014 01:10:40 -0400 Subject: [PATCH] Changed if/else statement series to switch. --- Jupiter/Functions.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Jupiter/Functions.c b/Jupiter/Functions.c index d993209..33dee5a 100644 --- a/Jupiter/Functions.c +++ b/Jupiter/Functions.c @@ -629,17 +629,22 @@ unsigned int strtoui_nospace(const char *str, int base) if (*str == '0') { str++; - if (*str == 'x' || *str == 'X') + switch (*str) { + case 'X': + case 'x': str++; base = 16; - } - else if (*str == 'b' || *str == 'B') - { + break; + case 'B': + case 'b': str++; base = 2; + break; + default: + base = 8; + break; } - else base = 8; } else base = 10; } @@ -752,19 +757,24 @@ unsigned int strtoui_nospace_s(const char *str, size_t length, int base) { if (--length == 0) return total; str++; - if (*str == 'x' || *str == 'X') + switch (*str) { + case 'X': + case 'x': if (--length == 0) return total; str++; base = 16; - } - else if (*str == 'b' || *str == 'B') - { + break; + case 'B': + case 'b': if (--length == 0) return total; str++; base = 2; + break; + default: + base = 8; + break; } - else base = 8; } else base = 10; }