-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from JohnLCaron/bigint
Add internal BigInteger copies for internal testing. kotlin jvm target is Java 17
- Loading branch information
Showing
24 changed files
with
7,888 additions
and
592 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4,461 changes: 4,461 additions & 0 deletions
4,461
egklib/src/jvmMain/java/org/cryptobiotic/bigint/BigInteger.java
Large diffs are not rendered by default.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
egklib/src/jvmMain/java/org/cryptobiotic/bigint/DoubleConsts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.cryptobiotic.bigint; | ||
|
||
public class DoubleConsts { | ||
/** | ||
* Don't let anyone instantiate this class. | ||
*/ | ||
private DoubleConsts() {} | ||
|
||
/** | ||
* The number of logical bits in the significand of a | ||
* {@code double} number, including the implicit bit. | ||
*/ | ||
public static final int SIGNIFICAND_WIDTH = 53; | ||
|
||
/** | ||
* The exponent the smallest positive {@code double} | ||
* subnormal value would have if it could be normalized.. | ||
*/ | ||
public static final int MIN_SUB_EXPONENT = Double.MIN_EXPONENT - | ||
(SIGNIFICAND_WIDTH - 1); | ||
|
||
/** | ||
* Bias used in representing a {@code double} exponent. | ||
*/ | ||
public static final int EXP_BIAS = 1023; | ||
|
||
/** | ||
* Bit mask to isolate the sign bit of a {@code double}. | ||
*/ | ||
public static final long SIGN_BIT_MASK = 0x8000000000000000L; | ||
|
||
/** | ||
* Bit mask to isolate the exponent field of a | ||
* {@code double}. | ||
*/ | ||
public static final long EXP_BIT_MASK = 0x7FF0000000000000L; | ||
|
||
/** | ||
* Bit mask to isolate the significand field of a | ||
* {@code double}. | ||
*/ | ||
public static final long SIGNIF_BIT_MASK = 0x000FFFFFFFFFFFFFL; | ||
|
||
static { | ||
// verify bit masks cover all bit positions and that the bit | ||
// masks are non-overlapping | ||
assert(((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0L) && | ||
(((SIGN_BIT_MASK & EXP_BIT_MASK) == 0L) && | ||
((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0L) && | ||
((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0L))); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
egklib/src/jvmMain/java/org/cryptobiotic/bigint/FloatConsts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.cryptobiotic.bigint; | ||
|
||
public class FloatConsts { | ||
/** | ||
* Don't let anyone instantiate this class. | ||
*/ | ||
private FloatConsts() {} | ||
|
||
/** | ||
* The number of logical bits in the significand of a | ||
* {@code float} number, including the implicit bit. | ||
*/ | ||
public static final int SIGNIFICAND_WIDTH = 24; | ||
|
||
/** | ||
* The exponent the smallest positive {@code float} subnormal | ||
* value would have if it could be normalized. | ||
*/ | ||
public static final int MIN_SUB_EXPONENT = Float.MIN_EXPONENT - | ||
(SIGNIFICAND_WIDTH - 1); | ||
|
||
/** | ||
* Bias used in representing a {@code float} exponent. | ||
*/ | ||
public static final int EXP_BIAS = 127; | ||
|
||
/** | ||
* Bit mask to isolate the sign bit of a {@code float}. | ||
*/ | ||
public static final int SIGN_BIT_MASK = 0x80000000; | ||
|
||
/** | ||
* Bit mask to isolate the exponent field of a | ||
* {@code float}. | ||
*/ | ||
public static final int EXP_BIT_MASK = 0x7F800000; | ||
|
||
/** | ||
* Bit mask to isolate the significand field of a | ||
* {@code float}. | ||
*/ | ||
public static final int SIGNIF_BIT_MASK = 0x007FFFFF; | ||
|
||
static { | ||
// verify bit masks cover all bit positions and that the bit | ||
// masks are non-overlapping | ||
assert(((SIGN_BIT_MASK | EXP_BIT_MASK | SIGNIF_BIT_MASK) == ~0) && | ||
(((SIGN_BIT_MASK & EXP_BIT_MASK) == 0) && | ||
((SIGN_BIT_MASK & SIGNIF_BIT_MASK) == 0) && | ||
((EXP_BIT_MASK & SIGNIF_BIT_MASK) == 0))); | ||
} | ||
} |
Oops, something went wrong.