func secdedClean(a []byte, cksum *uint64) int { var ( all = *cksum idx = all >> 1 i = uint64(3) ) for _, a := range a { bits := uint64(a) all ^= bits for n := 8; n > 0; n-- { bit := bits & 1 idx ^= i & -bit bits >>= 1 i += 2 } } all ^= all >> 32 all ^= all >> 16 all ^= all >> 8 all ^= all >> 8 all ^= all >> 2 all ^= all >> 1 switch { case all&1 == 0: if idx == 0 { return 0 } return -1 case idx&(idx-1) == 0: if idx == 0 { idx = 1 } else { idx <<= 1 } *cksum ^= idx default: idx -= 3 idx >>= 1 hi, lo := idx>>3, idx&7 if hi >= uint64(len(a)) { return -1 } a[hi] ^= 1 << lo } return 1 }
To receive a hint, submit unfixed code.