Function tampon::compare_buffers
source · [−]Expand description
Compare 2 buffers and return the absolute difference
.
Compare 2 buffers and return the absolute difference
.
If both buffers are identical in size AND content, this function will return 0.
Example(s)
// Import tampon function
use tampon::compare_buffers;
let b1:Vec<u8> = vec![5;5];
let b2:Vec<u8> = vec![5;5];
// Both buffer should be equal and return 0
assert!(tampon::compare_buffers(&b1,&b2)==0);
let b3:Vec<u8> = vec![4;4];
// Buffers should be different
assert!(tampon::compare_buffers(&b1,&b3)>0)
RunArgument(s)
b1
- FirstVec<u8>
buffer reference to compare.b2
- SecondVec<u8>
buffer reference to compare.
Return
Absolute difference between both buffers. Identical in size and content will return 0.