Start shifting stuff the actual math out into another file.

This commit is contained in:
2018-03-01 12:27:15 -08:00
parent 9fece39fe1
commit 2cc8702f4d
2 changed files with 98 additions and 92 deletions

17
src/cryptonum/core.rs Normal file
View File

@@ -0,0 +1,17 @@
use std::cmp::Ordering;
#[inline]
pub fn generic_cmp(a: &[u64], b: &[u64]) -> Ordering {
let mut i = a.len() - 1;
loop {
match a[i].cmp(&b[i]) {
Ordering::Equal if i == 0 =>
return Ordering::Equal,
Ordering::Equal =>
i -= 1,
res =>
return res
}
}
}