From: Kevin Day Date: Sun, 19 Jun 2022 00:11:07 +0000 (-0500) Subject: Bugfix: Add missing endianness check to f_convesion. X-Git-Tag: 0.5.10~33 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=db561ee7afe4b518f017d12be4deff0d90add6ad;p=fll Bugfix: Add missing endianness check to f_convesion. This just adds the inverse shift on the assumption that the original code is correct and is for little-endian. --- diff --git a/level_0/f_conversion/c/private-conversion.c b/level_0/f_conversion/c/private-conversion.c index 0bd7e92..72d0e67 100644 --- a/level_0/f_conversion/c/private-conversion.c +++ b/level_0/f_conversion/c/private-conversion.c @@ -96,7 +96,11 @@ extern "C" { } // for if (data.base == 2) { - work = 0x1 << (digits - 1); + #ifdef _is_F_endian_big + work = 0x1 >> (digits - 1); + #else + work = 0x1 << (digits - 1); + #endif // _is_F_endian_big while (digits--) { @@ -347,7 +351,11 @@ extern "C" { } // for if (data.base == 2) { - f_number_unsigned_t work = 0x1 << (digits - 1); + #ifdef _is_F_endian_big + f_number_unsigned_t work = 0x1 >> (digits - 1); + #else + f_number_unsigned_t work = 0x1 << (digits - 1); + #endif // _is_F_endian_big while (digits--) {