From 2fcc77cf25fe2d55c6e9f2f7b32313e10725a3e6 Mon Sep 17 00:00:00 2001 From: Aryan Malik <88618913+Aryan9592@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:30:04 +0530 Subject: [PATCH] Update Array.html: Fixed typos --- book/book/Array.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/book/Array.html b/book/book/Array.html index e861ba8..10b844a 100644 --- a/book/book/Array.html +++ b/book/book/Array.html @@ -179,7 +179,7 @@
keccak256(c) + 5
6th
element.
While reading the elements of the fixedU256Array
is simple, because, type uint256
takes up 32 bytes, the same cannot be said for the fixexU8Array
as they're packed and care would be taken to avoid messing up the value stored at that slot. We can always call an sload(slot)
to get the value of any index stored at any slot.
While reading the elements of the fixedU256Array
is simple, because, type uint256
takes up 32 bytes, the same cannot be said for the fixedU8Array
as they're packed and care would be taken to avoid messing up the value stored at that slot. We can always call an sload(slot)
to get the value of any index stored at any slot.
However, for fixedU8Array
on initialization:
contract Array {
uint8[3] public fixedU8Array;
@@ -193,7 +193,7 @@ R
Once the slot where the values of the fixedU8Array
has been located, which we shall address as loc
, we can call a simple sload(loc)
to get the value stored at that slot, which will be returned as:
0x0000000000000000000000000000000000000000000000000000000000030201
-It will be packed, as stated earlier. We can then use a masking to return any index in the array based of the uint8
type, 1 byte
by calculating its offset precisely.
+It will be packed, as stated earlier. We can then use a masking to return any index in the array based on the uint8
type, 1 byte
by calculating its offset precisely.
More Info