Skip to content

Commit

Permalink
math.big constants were no longer initialized
Browse files Browse the repository at this point in the history
Fixes #3243
  • Loading branch information
Kelimion committed Mar 3, 2024
1 parent 674bd94 commit 4c35633
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/math/big/helpers.odin
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,11 @@ int_from_bytes_little_python :: proc(a: ^Int, buf: []u8, signed := false, alloca
*/
INT_ONE, INT_ZERO, INT_MINUS_ONE, INT_INF, INT_MINUS_INF, INT_NAN := &Int{}, &Int{}, &Int{}, &Int{}, &Int{}, &Int{}

@(init, private)
_init_constants :: proc() {
initialize_constants()
}

initialize_constants :: proc() -> (res: int) {
internal_set( INT_ZERO, 0); INT_ZERO.flags = {.Immutable}
internal_set( INT_ONE, 1); INT_ONE.flags = {.Immutable}
Expand All @@ -788,7 +793,7 @@ initialize_constants :: proc() -> (res: int) {
*/
internal_set( INT_NAN, 1); INT_NAN.flags = {.Immutable, .NaN}
internal_set( INT_INF, 1); INT_INF.flags = {.Immutable, .Inf}
internal_set( INT_INF, -1); INT_MINUS_INF.flags = {.Immutable, .Inf}
internal_set(INT_MINUS_INF, -1); INT_MINUS_INF.flags = {.Immutable, .Inf}

return _DEFAULT_MUL_KARATSUBA_CUTOFF
}
Expand Down

0 comments on commit 4c35633

Please sign in to comment.