Commit 644e437c authored by Alina's avatar Alina Committed by GitHub

Simplify Casting (#128)

* abi.decode

* indent fix
parent f53f7653
......@@ -177,11 +177,15 @@ library Lib_BytesUtils {
pure
returns (bytes32)
{
bytes32 ret;
assembly {
ret := mload(add(_bytes, 32))
if (_bytes.length < 32) {
bytes32 ret;
assembly {
ret := mload(add(_bytes, 32))
}
return ret;
}
return ret;
return abi.decode(_bytes,(bytes32)); // will truncate if input length > 32 bytes
}
function toUint256(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment