zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit bca057afd28bdcc38b123c05915ca7d775a2a17d (tree)
parent c3e6ff7206c4e406bef8696171b40666ccd228b8
Author: Kendall Condon <goon.pri.low@gmail.com>
Date:   Wed, 11 Mar 2026 21:15:47 -0400

Smith.Weight: do not use of indexOfScalar

In larger fuzz tests this can cause the eval branch quota to be
exceeded.

Diffstat:
Mlib/std/Build/abi.zig | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/std/Build/abi.zig b/lib/std/Build/abi.zig @@ -250,9 +250,12 @@ pub const fuzz = struct { } // Reject types that don't have a fixed bitsize (esp. usize) // since they are not gauraunteed to fit in a u64 across targets. - if (std.mem.indexOfScalar(type, &.{ - usize, c_char, c_ushort, c_uint, c_ulong, c_ulonglong, - }, T) != null) { + // + // std.mem.indexOfScalar is not used to avoid backward branches + // and preserve the eval branch quota. + if (T == usize or T == c_char or T == c_ushort or + T == c_uint or T == c_ulong or T == c_ulonglong) + { @compileError("type does not have a fixed bitsize: " ++ @typeName(T)); } }