Use C.GoBytes in llvm2hash

This commit is contained in:
Paweł Bylica 2015-01-20 17:26:31 +01:00
parent 8989181652
commit 0f06b54a91

View file

@ -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 {