Skip to content

Instantly share code, notes, and snippets.

@oscarguindzberg
Created October 6, 2017 17:13
Show Gist options
  • Save oscarguindzberg/fba0086c185022ef2def66841fc80c1f to your computer and use it in GitHub Desktop.
Save oscarguindzberg/fba0086c185022ef2def66841fc80c1f to your computer and use it in GitHub Desktop.
subarray in solidity
bytes myByteArrayInStorage = ....;
uint pointer;
assembly {
pointer := myByteArrayInStorage_slot
}
uint pointer2 = uint(keccak256(bytes32(pointer)));
uint firstWord;
uint secondWord;
assembly {
firstWord := sload(pointer2)
secondWord := sload(add(pointer2,1))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment