in amazon-qldb-driver-core/src/qldb_hash.rs [40:65]
fn partial_cmp(&self, other: &QldbHash) -> Option<Ordering> {
if self.is_empty() {
if other.is_empty() {
return Some(Ordering::Equal);
} else {
return Some(Ordering::Less);
}
}
if other.is_empty() {
return Some(Ordering::Greater);
}
for (x, y) in self.bytes.iter().rev().zip(other.bytes.iter().rev()) {
// Note that Java compares bytes as signed integers. We
// store the bytes as unsigned bytes everywhere and simply
// re-interpret the bits at this point to determine
// ordering.
match (*x as i8).cmp(&(*y as i8)) {
Ordering::Equal => {}
cmp => return Some(cmp),
}
}
return Some(Ordering::Equal);
}