Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parent_many: force a constant to u64
By default, in 64 bits machine rustc will interpret constants as u32, but in parent_many we left shift a constant by the depth of the forest, which can be grather than 32. This would a 32-bits value to be left-shifted by more than 32. This is undefined behavour and should be avoided. This commit coerces the constants to u64, making it safe shift up to 63. Since tree with depth 63 would be impossible to see in practice (it would represent quadrilions of leaves), there's no risk of having the same UB now.
- Loading branch information