|
7 | 7 | * The dividend's low and high words are given by \p numhi and \p numlo, respectively. |
8 | 8 | * The divisor is given by \p den. |
9 | 9 | * \return the quotient, and the remainder by reference in \p r, if not null. |
10 | | - * If the quotient would require more than 64 bits, or if denom is 0, then return the max value |
11 | | - * for both quotient and remainder. |
| 10 | + * If the quotient would require more than 64 bits (32 bit for divlu), or if denom is 0, then return |
| 11 | + * the max value for both quotient and remainder. |
12 | 12 | * |
13 | 13 | * These functions are released into the public domain, where applicable, or the CC0 license. |
14 | 14 | */ |
@@ -112,11 +112,11 @@ uint64_t divllu(uint64_t numhi, uint64_t numlo, uint64_t den, uint64_t *r) |
112 | 112 |
|
113 | 113 | uint32_t divlu(uint32_t numhi, uint32_t numlo, uint32_t den, uint32_t *r) |
114 | 114 | { |
115 | | - // We work in base 2**32. |
| 115 | + // We work in base 2**16. |
116 | 116 | // A uint16 holds a single digit. A uint32 holds two digits. |
117 | 117 | // Our numerator is conceptually [num3, num2, num1, num0]. |
118 | 118 | // Our denominator is [den1, den0]. |
119 | | - const uint32_t b = (1ull << 16); |
| 119 | + const uint32_t b = (1ul << 16); |
120 | 120 |
|
121 | 121 | // The high and low digits of our computed quotient. |
122 | 122 | uint16_t q1; |
|
0 commit comments