Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmake/targets/BuildBun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,7 @@ set(BUN_DEPENDENCIES
BoringSSL
Brotli
Cares
Highway
LibDeflate
LolHtml
Lshpack
Expand Down
33 changes: 33 additions & 0 deletions cmake/targets/BuildHighway.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
register_repository(
NAME
highway
REPOSITORY
google/highway
COMMIT
12b325bc1793dee68ab2157995a690db859fe9e0
)

set(HIGHWAY_CMAKE_ARGS
# Build a static library
-DBUILD_SHARED_LIBS=OFF
# Enable position-independent code for linking into the main executable
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
# Disable unnecessary components
-DHWY_ENABLE_TESTS=OFF
-DHWY_ENABLE_EXAMPLES=OFF
-DHWY_ENABLE_CONTRIB=OFF
# Disable building of the install target
-DHWY_ENABLE_INSTALL=OFF
)

register_cmake_command(
TARGET
highway
LIBRARIES
hwy
ARGS
${HIGHWAY_CMAKE_ARGS}
INCLUDES
.
hwy
)
6 changes: 6 additions & 0 deletions src/bun.js/bindings/bun-simdutf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,10 @@ SIMDUTFResult simdutf__base64_decode_from_binary16(const char16_t* input, size_t

return { .error = res.error, .count = res.count };
}

size_t simdutf__utf16_length_from_latin1(const char* input, size_t length)
{
UNUSED_PARAM(input);
return simdutf::utf16_length_from_latin1(length);
}
}
5 changes: 5 additions & 0 deletions src/bun.js/bindings/bun-simdutf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub extern fn simdutf__utf8_length_from_utf32(input: [*c]const c_uint, length: u
pub extern fn simdutf__utf16_length_from_utf32(input: [*c]const c_uint, length: usize) usize;
pub extern fn simdutf__utf32_length_from_utf8(input: [*]const u8, length: usize) usize;
pub extern fn simdutf__utf8_length_from_latin1(input: [*]const u8, length: usize) usize;
pub extern fn simdutf__utf16_length_from_latin1(input: [*]const u8, length: usize) usize;

pub const validate = struct {
pub const with_errors = struct {
Expand Down Expand Up @@ -295,6 +296,10 @@ pub const length = struct {
JSC.markBinding(@src());
return simdutf__utf16_length_from_utf32(input.ptr, input.len);
}

pub fn latin1(input: []const u8) usize {
return simdutf__utf16_length_from_latin1(input.ptr, input.len);
}
};
};

Expand Down
Loading