We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
indexOfDiff
1 parent 6fc5608 commit ad384f4Copy full SHA for ad384f4
lib/std/mem.zig
@@ -787,7 +787,7 @@ fn eqlBytes(a: []const u8, b: []const u8) bool {
787
/// Compares two slices and returns the index of the first inequality.
788
/// Returns null if the slices are equal.
789
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))
+ if (!@inComptime() and @sizeOf(T) != 0 and std.meta.hasUniqueRepresentation(T) and eqlBytes_allowed)
791
return if (indexOfDiffBytes(sliceAsBytes(a), sliceAsBytes(b))) |index| index / @sizeOf(T) else return null;
792
793
const shortest = @min(a.len, b.len);
0 commit comments