mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +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 {
|
func llvm2hash(m *i256) []byte {
|
||||||
hash := make([]byte, len(m)) // TODO: Use C.GoBytes
|
if len(m) != 32 {
|
||||||
hdr := reflect.SliceHeader{
|
panic("I don't know Go!")
|
||||||
Data: uintptr(unsafe.Pointer(m)),
|
|
||||||
Len: int(len(m)),
|
|
||||||
Cap: int(len(m)),
|
|
||||||
}
|
}
|
||||||
copy(hash, *(*[]byte)(unsafe.Pointer(&hdr)))
|
return C.GoBytes(unsafe.Pointer(m), 32)
|
||||||
return hash
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func address2llvm(addr []byte) i256 {
|
func address2llvm(addr []byte) i256 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue