Skip to content

Commit 952dceb

Browse files
Correct some comments and type in divlu.c
1 parent c2d2be3 commit 952dceb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

doc/divlu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* The dividend's low and high words are given by \p numhi and \p numlo, respectively.
88
* The divisor is given by \p den.
99
* \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.
1212
*
1313
* These functions are released into the public domain, where applicable, or the CC0 license.
1414
*/
@@ -112,11 +112,11 @@ uint64_t divllu(uint64_t numhi, uint64_t numlo, uint64_t den, uint64_t *r)
112112

113113
uint32_t divlu(uint32_t numhi, uint32_t numlo, uint32_t den, uint32_t *r)
114114
{
115-
// We work in base 2**32.
115+
// We work in base 2**16.
116116
// A uint16 holds a single digit. A uint32 holds two digits.
117117
// Our numerator is conceptually [num3, num2, num1, num0].
118118
// Our denominator is [den1, den0].
119-
const uint32_t b = (1ull << 16);
119+
const uint32_t b = (1ul << 16);
120120

121121
// The high and low digits of our computed quotient.
122122
uint16_t q1;

0 commit comments

Comments
 (0)