pub const unsafe fn compare_bytes(
_left: *const u8,
_right: *const u8,
_bytes: usize,
) -> i32
🔬This is a nightly-only experimental API. (
core_intrinsics
)Expand description
Lexicographically compare [left, left + bytes)
and [right, right + bytes)
as unsigned bytes, returning negative if left
is less, zero if all the
bytes match, or positive if left
is greater.
This underlies things like <[u8]>::cmp
, and will usually lower to memcmp
.
§Safety
left
and right
must each be valid for reads of bytes
bytes.
Note that this applies to the whole range, not just until the first byte that differs. That allows optimizations that can read in large chunks.