15 lines
198 B
Go
15 lines
198 B
Go
|
|
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
|
||
|
|
}
|