diff options
author | 2022-11-14 04:40:53 +0100 | |
---|---|---|
committer | 2022-11-14 04:40:53 +0100 | |
commit | 3c8444458fcb243e4efb9eb9898076bd52acd63f (patch) | |
tree | 489f017ba14fd087bda077c0960726be610e3240 | |
parent | eb4724f81691fecd8bc68cdb5c78a921c377fc10 (diff) | |
download | bun-3c8444458fcb243e4efb9eb9898076bd52acd63f.tar.gz bun-3c8444458fcb243e4efb9eb9898076bd52acd63f.tar.zst bun-3c8444458fcb243e4efb9eb9898076bd52acd63f.zip |
@alignCast
-rw-r--r-- | src/string_immutable.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig index 2c4f174e3..973f448e2 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -3076,7 +3076,8 @@ pub fn firstNonASCII16CheckMin(comptime Slice: type, slice: Slice, comptime chec // it removes a loop, but probably is slower in the end const cmp = @bitCast(AsciiVectorU16U1, vec > max_u16_ascii) | @bitCast(AsciiVectorU16U1, vec < min_u16_ascii); - const bitmask: u16 = @ptrCast(*const u16, &cmp).*; + const cmp_aligned = @alignCast(2, &cmp); + const bitmask: u16 = @ptrCast(*const u16, &cmp_aligned).*; const first = @ctz(@as(u16, bitmask)); return @intCast(u32, @as(u32, first) + @@ -3087,7 +3088,8 @@ pub fn firstNonASCII16CheckMin(comptime Slice: type, slice: Slice, comptime chec remaining.len -= (@ptrToInt(remaining.ptr) - @ptrToInt(remaining_start)) / 2; const cmp = vec > max_u16_ascii; - const bitmask = @ptrCast(*const u16, &cmp).*; + const cmp_aligned = @alignCast(2, &cmp); + const bitmask = @ptrCast(*const u16, &cmp_aligned).*; const first = @ctz(@as(u16, bitmask)); return @intCast(u32, @as(u32, first) + |