1 parent e814add commit bec4506Copy full SHA for bec4506
1 file changed
proof/proof.go
@@ -220,9 +220,15 @@ func reverse(ids []compact.NodeID) {
220
}
221
222
func isSubtreeValid(start, end uint64) bool {
223
- shift := bits.Len64(end - start - 1)
224
- if shift >= 64 {
225
- return start == 0
+ if start == 0 {
+ return true
226
227
- return start%(uint64(1)<<shift) == 0
+ return start%bitCeil(end-start) == 0
+}
228
+
229
+func bitCeil(n uint64) uint64 {
230
+ if n <= 1 {
231
+ return 1
232
+ }
233
+ return uint64(1) << bits.Len64(n-1)
234
0 commit comments