🐛 Account for file ids > 9
This commit is contained in:
parent
a495a2ef1a
commit
495d50ba10
7 changed files with 40 additions and 37 deletions
14
checksum.go
Normal file
14
checksum.go
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue