Skip to content

Commit ad384f4

Browse files
committed
Add SIMD support detection for indexOfDiff
1 parent 6fc5608 commit ad384f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/mem.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ fn eqlBytes(a: []const u8, b: []const u8) bool {
787787
/// Compares two slices and returns the index of the first inequality.
788788
/// Returns null if the slices are equal.
789789
pub fn indexOfDiff(comptime T: type, a: []const T, b: []const T) ?usize {
790-
if (!@inComptime() and @sizeOf(T) != 0 and std.meta.hasUniqueRepresentation(T))
790+
if (!@inComptime() and @sizeOf(T) != 0 and std.meta.hasUniqueRepresentation(T) and eqlBytes_allowed)
791791
return if (indexOfDiffBytes(sliceAsBytes(a), sliceAsBytes(b))) |index| index / @sizeOf(T) else return null;
792792

793793
const shortest = @min(a.len, b.len);

0 commit comments

Comments
 (0)