Start shifting stuff the actual math out into another file.
This commit is contained in:
17
src/cryptonum/core.rs
Normal file
17
src/cryptonum/core.rs
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
1011
src/cryptonum/mod.rs
Normal file
1011
src/cryptonum/mod.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user