aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vaughan Rouesnel <vrouesnel@gmail.com> 2022-11-14 04:40:53 +0100
committerGravatar Vaughan Rouesnel <vrouesnel@gmail.com> 2022-11-14 04:40:53 +0100
commit3c8444458fcb243e4efb9eb9898076bd52acd63f (patch)
tree489f017ba14fd087bda077c0960726be610e3240
parenteb4724f81691fecd8bc68cdb5c78a921c377fc10 (diff)
downloadbun-3c8444458fcb243e4efb9eb9898076bd52acd63f.tar.gz
bun-3c8444458fcb243e4efb9eb9898076bd52acd63f.tar.zst
bun-3c8444458fcb243e4efb9eb9898076bd52acd63f.zip
@alignCast
-rw-r--r--src/string_immutable.zig6
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) +