Skip to content

Commit

Permalink
Update BitMap.mod javadoc
Browse files Browse the repository at this point in the history
Add thrown exception when divisor is zero. Add link to reference
implementation of Long.remainderUnsigned.

Drop redundant @SInCE tag as it matches the entire class @SInCE.
  • Loading branch information
aherbert committed Jun 13, 2023
1 parent 1624bdb commit 5b668d2
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,19 @@ public static long getLongBit(final int bitIndex) {
}

/**
* Performs a modulus calculation on an unsigned long and an positive integer divisor.
* Performs a modulus calculation on an unsigned long and a positive integer divisor.
*
* <p>This method computes the same result as {@link Long#remainderUnsigned(long, long)}
* but assumes that the divisor is an integer in the range 1 to 2<sup>31</sup> - 1 inclusive,
* that is a strictly positive integer size.
*
* <p><em>If the divisor is negative the behavior is not defined.</em></p>
*
* @param dividend a unsigned long value to calculate the modulus of.
* @param divisor the divisor for the modulus calculation, must be positive.
* @param dividend an unsigned long value to calculate the modulus of.
* @param divisor the divisor for the modulus calculation, must be strictly positive.
* @return the remainder or modulus value.
* @since 4.5
* @throws ArithmeticException if the divisor is zero
* @see Long#remainderUnsigned(long, long)
*/
public static int mod(final long dividend, final int divisor) {
// See Hacker's Delight (2nd ed), section 9.3.
Expand Down

0 comments on commit 5b668d2

Please sign in to comment.