mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Allocate memory for hash values coming from JIT
This commit is contained in:
parent
06e0da25bc
commit
548c9aef82
1 changed files with 4 additions and 2 deletions
|
|
@ -61,13 +61,15 @@ func hash2llvm(h []byte) i256 {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func llvm2hash(m *i256) []byte { //TODO: It should copy data
|
func llvm2hash(m *i256) []byte {
|
||||||
|
hash := make([]byte, len(m))
|
||||||
hdr := reflect.SliceHeader{
|
hdr := reflect.SliceHeader{
|
||||||
Data: uintptr(unsafe.Pointer(m)),
|
Data: uintptr(unsafe.Pointer(m)),
|
||||||
Len: int(len(m)),
|
Len: int(len(m)),
|
||||||
Cap: int(len(m)),
|
Cap: int(len(m)),
|
||||||
}
|
}
|
||||||
return *(*[]byte)(unsafe.Pointer(&hdr))
|
copy(hash, *(*[]byte)(unsafe.Pointer(&hdr)))
|
||||||
|
return hash
|
||||||
}
|
}
|
||||||
|
|
||||||
func bswap(m *i256) *i256 {
|
func bswap(m *i256) *i256 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue