| ... | @@ -861,7 +861,10 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize { | ... | @@ -861,7 +861,10 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize { |
| 861 | }, | 861 | }, |
| 862 | .Many => if (ptr_info.sentinel) |sentinel_ptr| { | 862 | .Many => if (ptr_info.sentinel) |sentinel_ptr| { |
| 863 | const sentinel = @as(*align(1) const ptr_info.child, @ptrCast(sentinel_ptr)).*; | 863 | const sentinel = @as(*align(1) const ptr_info.child, @ptrCast(sentinel_ptr)).*; |
| 864 | // We may be looking for something other than the sentinel, | 864 | if (sentinel == end) { |
| | 865 | return indexOfSentinel(ptr_info.child, end, ptr); |
| | 866 | } |
| | 867 | // We're looking for something other than the sentinel, |
| 865 | // but iterating past the sentinel would be a bug so we need | 868 | // but iterating past the sentinel would be a bug so we need |
| 866 | // to check for both. | 869 | // to check for both. |
| 867 | var i: usize = 0; | 870 | var i: usize = 0; |