From c8f5ff73c0ec979963b8e59d41f85f9753e515c7 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Wed, 18 Jan 2023 15:59:20 -0500 Subject: [PATCH] src: fix endianness of simdutf --- src/node_builtins.cc | 2 +- test/cctest/test_util.cc | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/node_builtins.cc b/src/node_builtins.cc index d6b5114aa3c4aa..dc7592df9de1f0 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -256,7 +256,7 @@ bool BuiltinLoader::Add(const char* id, std::string_view utf8source) { size_t expected_u16_length = simdutf::utf16_length_from_utf8(utf8source.data(), utf8source.length()); auto out = std::make_shared>(expected_u16_length); - size_t u16_length = simdutf::convert_utf8_to_utf16le( + size_t u16_length = simdutf::convert_utf8_to_utf16( utf8source.data(), utf8source.length(), reinterpret_cast(out->data())); diff --git a/test/cctest/test_util.cc b/test/cctest/test_util.cc index 443a03117c09fc..5b83e07db3b7c2 100644 --- a/test/cctest/test_util.cc +++ b/test/cctest/test_util.cc @@ -299,17 +299,3 @@ TEST(UtilTest, SPrintF) { const std::string with_zero = std::string("a") + '\0' + 'b'; EXPECT_EQ(SPrintF("%s", with_zero), with_zero); } - -TEST(UtilTest, SimdutfEndiannessDoesNotMeanEndianness) { - // In simdutf, "LE" does *not* refer to Little Endian, it refers - // to 16-byte code units that are stored using *host* endianness. - // This is weird and confusing naming, and so we add this assertion - // here to verify that this is actually the case (so that CI tells - // us if it changed, because for most people Little Endian is - // host endianness, so locally everything would work fine). - const char utf8source[] = "\xe7\x8c\xab"; - char16_t u16output; - size_t u16len = simdutf::convert_utf8_to_utf16le(utf8source, 3, &u16output); - EXPECT_EQ(u16len, 1u); - EXPECT_EQ(u16output, 0x732B); -}