1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2023.
*
* This software is free software;
*
* You can redistribute it or modify it under terms of the MIT, Apache License or Zlib license
*/
//! Mathematical operations shared amongst functions
/// Implement fast integer division from
/// Daniel's Lemire fastmod.
///
/// See [Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries](https://arxiv.org/abs/1902.01961),
/// Software: Practice and Experience 49 (6), 2019.
// /// Implement fast integer division from
// /// Daniel's Lemire fastmod.
// ///
// /// See [Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries](https://arxiv.org/abs/1902.01961),
// /// Software: Practice and Experience 49 (6), 2019.
// #[inline(always)]
// #[must_use]
// fn mul128_u32(low_bits: u64, d: u32) -> u64 {
// return ((u128::from(low_bits) * u128::from(d)) >> 64) as u64;
// }
/// Fast division of u32 numbers
///
/// Implement fast integer division from
/// See [Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries](https://arxiv.org/abs/1902.01961),
/// Software: Practice and Experience 49 (6), 2019.
/// Test fast_div works