summaryrefslogtreecommitdiff
path: root/libc/test/UnitTest/MemoryMatcher.cpp
diff options
context:
space:
mode:
authorMichael Jones <michaelrj@google.com>2024-12-03 12:36:04 -0800
committerGitHub <noreply@github.com>2024-12-03 12:36:04 -0800
commita0c4f854cad2b97e44a1b58dc1fd982e1c4d60f3 (patch)
tree8acd1dae248ac3e2d29b7af99c243635abec1747 /libc/test/UnitTest/MemoryMatcher.cpp
parente0ae7793fca0c78919bc41ffd407acb62146ad47 (diff)
[libc] Change ctype to be encoding independent (#110574)
The previous implementation of the ctype functions assumed ASCII. This patch changes to a switch/case implementation that looks odd, but actually is easier for the compiler to understand and optimize.
Diffstat (limited to 'libc/test/UnitTest/MemoryMatcher.cpp')
-rw-r--r--libc/test/UnitTest/MemoryMatcher.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/test/UnitTest/MemoryMatcher.cpp b/libc/test/UnitTest/MemoryMatcher.cpp
index 244f25572c37..3cd5174fd7f7 100644
--- a/libc/test/UnitTest/MemoryMatcher.cpp
+++ b/libc/test/UnitTest/MemoryMatcher.cpp
@@ -8,6 +8,7 @@
#include "MemoryMatcher.h"
+#include "src/__support/ctype_utils.h"
#include "src/__support/macros/config.h"
#include "test/UnitTest/Test.h"
@@ -40,7 +41,8 @@ bool MemoryMatcher::match(MemoryView actualValue) {
static void display(char C) {
const auto print = [](unsigned char I) {
- tlog << static_cast<char>(I < 10 ? '0' + I : 'A' + I - 10);
+ tlog << static_cast<char>(LIBC_NAMESPACE::internal::toupper(
+ LIBC_NAMESPACE::internal::int_to_b36_char(I)));
};
print(static_cast<unsigned char>(C) / 16);
print(static_cast<unsigned char>(C) & 15);