library: hash, hash/crc64

This commit is contained in:
xushiwei
2024-07-30 18:26:33 +08:00
parent bdca09007d
commit aae7af2194
3 changed files with 14 additions and 1 deletions

View File

@@ -297,6 +297,8 @@ Here are the Go packages that can be imported correctly:
* [encoding/base32](https://pkg.go.dev/encoding/base32)
* [encoding/base64](https://pkg.go.dev/encoding/base64)
* [encoding/csv](https://pkg.go.dev/encoding/csv)
* [hash](https://pkg.go.dev/hash)
* [hash/crc64](https://pkg.go.dev/hash/crc64)
* [crypto/md5](https://pkg.go.dev/crypto/md5)
* [regexp](https://pkg.go.dev/regexp)
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)

11
_cmptest/crcdemo/crc.go Normal file
View File

@@ -0,0 +1,11 @@
package main
import (
"fmt"
"hash/crc64"
)
func main() {
crc := crc64.MakeTable(crc64.ECMA)
fmt.Printf("%016x\n", crc64.Checksum([]byte("Hello world"), crc))
}

View File

@@ -562,7 +562,7 @@ func (b Builder) BinOp(op token.Token, x, y Expr) Expr {
return Expr{llvm.CreateICmp(b.impl, pred, x.impl, y.impl), tret}
}
case vkArray:
typ := x.raw.Type.(*types.Array)
typ := x.raw.Type.Underlying().(*types.Array)
elem := b.Prog.Elem(x.Type)
ret := prog.BoolVal(true)
for i, n := 0, int(typ.Len()); i < n; i++ {