From 2d43be7f5cf8288773b8748b4caffa19997ebd37 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 13 Nov 2021 15:24:38 -0600 Subject: [PATCH] Bugfix: Base 10 was used in hexdigit for comparison, resulting in invalid number conversion. Looks like I accidentally used based 10 numbers. The 0x29 is supposed to be 0x2f (I was thinking 30-1 = 29, but in hex it is actually 2f). --- level_0/f_conversion/c/conversion.c | 14 +++++++------- level_1/fl_conversion/c/conversion.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/level_0/f_conversion/c/conversion.c b/level_0/f_conversion/c/conversion.c index 72c180e..852a2a5 100644 --- a/level_0/f_conversion/c/conversion.c +++ b/level_0/f_conversion/c/conversion.c @@ -19,7 +19,7 @@ extern "C" { #ifndef _di_f_conversion_character_is_decimal_ f_status_t f_conversion_character_is_decimal(const char character) { - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { return F_true; } @@ -30,7 +30,7 @@ extern "C" { #ifndef _di_f_conversion_character_is_duodecimal_ f_status_t f_conversion_character_is_duodecimal(const char character) { - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { return F_true; } @@ -49,7 +49,7 @@ extern "C" { #ifndef _di_f_conversion_character_is_hexidecimal_ f_status_t f_conversion_character_is_hexidecimal(const char character) { - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { return F_true; } else if (character > 0x40 && character < 0x47) { @@ -66,7 +66,7 @@ extern "C" { #ifndef _di_f_conversion_character_is_octal_ f_status_t f_conversion_character_is_octal(const char character) { - if (character > 0x29 && character < 0x38) { + if (character > 0x2f && character < 0x38) { return F_true; } @@ -98,7 +98,7 @@ extern "C" { if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { *number = 0xf & character; return F_none; @@ -114,7 +114,7 @@ extern "C" { if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { *number = 0xf & character; return F_none; @@ -136,7 +136,7 @@ extern "C" { if (!number) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - if (character > 0x29 && character < 0x40) { + if (character > 0x2f && character < 0x3a) { *number = 0xf & character; return F_none; diff --git a/level_1/fl_conversion/c/conversion.c b/level_1/fl_conversion/c/conversion.c index 2533c94..52da4ef 100644 --- a/level_1/fl_conversion/c/conversion.c +++ b/level_1/fl_conversion/c/conversion.c @@ -196,7 +196,7 @@ extern "C" { *number = 0; return F_none; } - else if (string[j] > 0x29 && string[j] < 0x3a) { + else if (string[j] > 0x2f && string[j] < 0x3a) { mode = 10; } else if (string[j] == 0x78 || string[j] == 0x58) { @@ -358,7 +358,7 @@ extern "C" { *number = 0; return F_none; } - else if (string[j] > 0x29 && string[j] < 0x3a) { + else if (string[j] > 0x2f && string[j] < 0x3a) { mode = 10; } else if (string[j] == 0x78 || string[j] == 0x58) { -- 1.8.3.1