Skip to content

Commit 717d667

Browse files
author
Rafael Mohr
committed
switch to 64 bit divmask
1 parent 4e0d7ec commit 717d667

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/siggb/hashtable.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ end
3535
# initialize and set fields for basis hashtable
3636
function initialize_basis_hash_table(::Val{N}) where N
3737

38-
# for now at most 32 variables
39-
if N > 32
40-
error("At most 32 variables currently supported.")
38+
# for now at most 64 variables
39+
if N > 64
40+
error("At most 64 variables currently supported.")
4141
end
4242

4343
# not necessary to create `initial_size` exponents
@@ -50,8 +50,8 @@ function initialize_basis_hash_table(::Val{N}) where N
5050
size = init_ht_size
5151

5252
# initialize fast divisibility params
53-
int32bits = 32
54-
ndivbits = div(int32bits, N)
53+
int64bits = 64
54+
ndivbits = div(64, N)
5555
# division mask stores at least 1 bit
5656
# per each of first ndivvars variables
5757
ndivbits == 0 && (ndivbits += 1)
@@ -270,16 +270,17 @@ function fill_divmask!(ht::MonomialHashtable{N}) where N
270270
end
271271

272272
ctr = 1
273-
steps = UInt32(0)
273+
steps = DivMask(0)
274274
@inbounds for i in 1:N
275-
steps = div(max_exp[i] - min_exp[i], UInt32(ht.ndivbits))
276-
(iszero(steps)) && (steps += UInt32(1))
275+
steps = div(DivMask(max_exp[i] - min_exp[i]), DivMask(ht.ndivbits))
276+
(iszero(steps)) && (steps += DivMask(1))
277277
for j in 1:ht.ndivbits
278278
ht.divmap[ctr] = steps
279-
steps += UInt32(1)
279+
steps += DivMask(1)
280280
ctr += 1
281281
end
282282
end
283+
283284
@inbounds for vidx in 1:ht.load
284285
m = ht.exponents[vidx]
285286
divm = divmask(m, ht.divmap, ht.ndivbits)

src/siggb/typedefs.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const Exp = Int16
66
# types for hashvalue, ht index and divisor mask of a monomial
77
const MonIdx = Int32
88
const MonHash = UInt32
9-
const DivMask = UInt32
9+
const DivMask = UInt64
1010
# stuff for matrix
1111
const ColIdx = UInt32
1212
const Coeff = UInt32
@@ -45,7 +45,7 @@ mutable struct MonomialHashtable{N}
4545

4646
#= Monom divisibility =#
4747
# divisor map to check divisibility faster
48-
divmap::Vector{UInt32}
48+
divmap::Vector{DivMask}
4949
# bits per div variable
5050
ndivbits::Int
5151

0 commit comments

Comments
 (0)