ashaffer / mini-hamt

18 stars 0 forks source link

Replace hard coded number with constant #3

Open ivenmarquardt opened 5 years ago

ivenmarquardt commented 5 years ago

I wonder if 4 depends on the number of bits used and thus should be also a constant that must be adjusted as soon the number of bits are altered?

function getFrag (code, depth) {
  return (code >>> (4 * depth)) & mask
}

I not yet fully understand the algorithm though, so maybe I'm mistaken and you can close this issue.