diff --git a/libc/test/src/stdlib/strtol_test.cpp b/libc/test/src/stdlib/strtol_test.cpp --- a/libc/test/src/stdlib/strtol_test.cpp +++ b/libc/test/src/stdlib/strtol_test.cpp @@ -149,14 +149,14 @@ if (input < 0 || input > 36) return '0'; if (input < 10) - return '0' + input; - return 'A' + input - 10; + return static_cast('0' + input); + return static_cast('A' + input - 10); } TEST(LlvmLibcStrToLTest, DecodeInOtherBases) { char small_string[4] = {'\0', '\0', '\0', '\0'}; - for (long base = 2; base <= 36; ++base) { - for (long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); if (first_digit < base) { errno = 0; @@ -171,10 +171,10 @@ } } - for (long base = 2; base <= 36; ++base) { - for (long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { errno = 0; @@ -195,12 +195,12 @@ } } - for (long base = 2; base <= 36; ++base) { - for (long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); - for (long third_digit = 0; third_digit <= 36; ++third_digit) { + for (int third_digit = 0; third_digit <= 36; ++third_digit) { small_string[2] = int_to_b36_char(third_digit); if (first_digit < base && second_digit < base && third_digit < base) { diff --git a/libc/test/src/stdlib/strtoll_test.cpp b/libc/test/src/stdlib/strtoll_test.cpp --- a/libc/test/src/stdlib/strtoll_test.cpp +++ b/libc/test/src/stdlib/strtoll_test.cpp @@ -173,14 +173,14 @@ if (input < 0 || input > 36) return '0'; if (input < 10) - return '0' + input; - return 'A' + input - 10; + return static_cast('0' + input); + return static_cast('A' + input - 10); } TEST(LlvmLibcStrToLLTest, DecodeInOtherBases) { char small_string[4] = {'\0', '\0', '\0', '\0'}; - for (long long base = 2; base <= 36; ++base) { - for (long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); if (first_digit < base) { errno = 0; @@ -195,10 +195,10 @@ } } - for (long long base = 2; base <= 36; ++base) { - for (long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (long long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { errno = 0; @@ -219,12 +219,12 @@ } } - for (long long base = 2; base <= 36; ++base) { - for (long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (long long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); - for (long long third_digit = 0; third_digit <= 36; ++third_digit) { + for (int third_digit = 0; third_digit <= 36; ++third_digit) { small_string[2] = int_to_b36_char(third_digit); if (first_digit < base && second_digit < base && third_digit < base) { diff --git a/libc/test/src/stdlib/strtoul_test.cpp b/libc/test/src/stdlib/strtoul_test.cpp --- a/libc/test/src/stdlib/strtoul_test.cpp +++ b/libc/test/src/stdlib/strtoul_test.cpp @@ -8,12 +8,12 @@ #include "src/stdlib/strtoul.h" -#include "utils/UnitTest/Test.h" - #include #include #include +#include "utils/UnitTest/Test.h" + TEST(LlvmLibcStrToULTest, InvalidBase) { const char *ten = "10"; errno = 0; @@ -141,14 +141,14 @@ if (input < 0 || input > 36) return '0'; if (input < 10) - return '0' + input; - return 'A' + input - 10; + return static_cast('0' + input); + return static_cast('A' + input - 10); } TEST(LlvmLibcStrToULTest, DecodeInOtherBases) { char small_string[4] = {'\0', '\0', '\0', '\0'}; - for (unsigned long base = 2; base <= 36; ++base) { - for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); if (first_digit < base) { errno = 0; @@ -163,10 +163,10 @@ } } - for (unsigned long base = 2; base <= 36; ++base) { - for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (unsigned long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { errno = 0; @@ -187,12 +187,12 @@ } } - for (unsigned long base = 2; base <= 36; ++base) { - for (unsigned long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (unsigned long second_digit = 0; second_digit <= 36; ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); - for (unsigned long third_digit = 0; third_digit <= 36; ++third_digit) { + for (int third_digit = 0; third_digit <= 36; ++third_digit) { small_string[2] = int_to_b36_char(third_digit); if (first_digit < base && second_digit < base && third_digit < base) { diff --git a/libc/test/src/stdlib/strtoull_test.cpp b/libc/test/src/stdlib/strtoull_test.cpp --- a/libc/test/src/stdlib/strtoull_test.cpp +++ b/libc/test/src/stdlib/strtoull_test.cpp @@ -8,12 +8,12 @@ #include "src/stdlib/strtoull.h" -#include "utils/UnitTest/Test.h" - #include #include #include +#include "utils/UnitTest/Test.h" + TEST(LlvmLibcStrToULLTest, InvalidBase) { const char *ten = "10"; errno = 0; @@ -149,14 +149,14 @@ if (input < 0 || input > 36) return '0'; if (input < 10) - return '0' + input; - return 'A' + input - 10; + return static_cast('0' + input); + return static_cast('A' + input - 10); } TEST(LlvmLibcStrToULLTest, DecodeInOtherBases) { char small_string[4] = {'\0', '\0', '\0', '\0'}; - for (unsigned long long base = 2; base <= 36; ++base) { - for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); if (first_digit < base) { errno = 0; @@ -171,11 +171,10 @@ } } - for (unsigned long long base = 2; base <= 36; ++base) { - for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (unsigned long long second_digit = 0; second_digit <= 36; - ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); if (first_digit < base && second_digit < base) { errno = 0; @@ -196,14 +195,12 @@ } } - for (unsigned long long base = 2; base <= 36; ++base) { - for (unsigned long long first_digit = 0; first_digit <= 36; ++first_digit) { + for (int base = 2; base <= 36; ++base) { + for (int first_digit = 0; first_digit <= 36; ++first_digit) { small_string[0] = int_to_b36_char(first_digit); - for (unsigned long long second_digit = 0; second_digit <= 36; - ++second_digit) { + for (int second_digit = 0; second_digit <= 36; ++second_digit) { small_string[1] = int_to_b36_char(second_digit); - for (unsigned long long third_digit = 0; third_digit <= 36; - ++third_digit) { + for (int third_digit = 0; third_digit <= 36; ++third_digit) { small_string[2] = int_to_b36_char(third_digit); if (first_digit < base && second_digit < base && third_digit < base) {