Shuffling for 32 bit platforms (#7725)

- In shuffling, a the raw_pivot (u64) is cast to a usize which will break on 32 bit systems. Now it is modulo'ed with the list_size first then cast to a usize.
- ruint doesn't implement shifting with u64's on 32-bit arch. Since `prefix_bits` is u8 and NODE_ID_BITS = 256, we use them as u32's instead.

See: https://docs.rs/ruint/latest/src/ruint/bits.rs.html#711
This commit is contained in:
Eric Tu
2025-08-05 22:37:07 -04:00
committed by GitHub
parent 0dcce40ccb
commit c06ac81c67
2 changed files with 3 additions and 4 deletions

View File

@@ -96,8 +96,7 @@ pub fn shuffle_list(
loop {
buf.set_round(r);
let pivot = buf.raw_pivot() as usize % list_size;
let pivot = (buf.raw_pivot() % list_size as u64) as usize;
let mirror = (pivot + 1) >> 1;
buf.mix_in_position(pivot >> 8);