🐛 Account for file ids > 9

This commit is contained in:
Dan Jones 2024-12-09 14:34:01 -06:00
commit 495d50ba10
7 changed files with 40 additions and 37 deletions

14
checksum.go Normal file
View file

@ -0,0 +1,14 @@
package defrag
// import "strconv"
func Checksum(blocks []int) (sum int, err error) {
for idx, fileByte := range blocks {
if fileByte == -1 {
break
}
sum += idx * fileByte
}
return
}