pub fn is_equal(x: &[u8], y: &[u8]) -> bool
Expand description
Compare corresponding bytes in x
and y
for equality.
That is, this returns true if and only if x.len() == y.len()
and
x[i] == y[i]
for all 0 <= i < x.len()
.
Inlining
This routine is marked inline(always)
. If you want to call this function
in a way that is not always inlined, you’ll need to wrap a call to it in
another function that is marked as inline(never)
or just inline
.
Motivation
Why not use slice equality instead? Well, slice equality usually results in
a call out to the current platform’s libc
which might not be inlineable
or have other overhead. This routine isn’t guaranteed to be a win, but it
might be in some cases.