mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Use C.GoBytes in llvm2hash
This commit is contained in:
parent
8989181652
commit
0f06b54a91
1 changed files with 3 additions and 7 deletions
10
vm/vm_jit.go
10
vm/vm_jit.go
|
|
@ -61,14 +61,10 @@ func hash2llvm(h []byte) i256 {
|
|||
}
|
||||
|
||||
func llvm2hash(m *i256) []byte {
|
||||
hash := make([]byte, len(m)) // TODO: Use C.GoBytes
|
||||
hdr := reflect.SliceHeader{
|
||||
Data: uintptr(unsafe.Pointer(m)),
|
||||
Len: int(len(m)),
|
||||
Cap: int(len(m)),
|
||||
if len(m) != 32 {
|
||||
panic("I don't know Go!")
|
||||
}
|
||||
copy(hash, *(*[]byte)(unsafe.Pointer(&hdr)))
|
||||
return hash
|
||||
return C.GoBytes(unsafe.Pointer(m), 32)
|
||||
}
|
||||
|
||||
func address2llvm(addr []byte) i256 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue