Skip to content

Commit

Permalink
Fix documentation typos (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair-singh authored Nov 27, 2023
1 parent 7345872 commit 8db1e49
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/src/utils/Uint16Array.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pragma solidity 0.8.22;
* expensive in terms of gas. The BeefyClient only needs 16 bits per counter. This library allows us to pack
* 16 uint16 into a single uint256 and save 16x storage.
*
* Layout of 8 counters (2 uint256)
* Layout of 32 counters (2 uint256)
* We store all counts in a single large uint256 array and convert from index from the logical uint16 array
* to the physical uint256 array.
*
Expand All @@ -27,7 +27,7 @@ pragma solidity 0.8.22;
* In the above table counter YY is at logical index 12 in the uint16 array. It will convert to a physical
* index of 0 in the physical uint256 array and then to bit-index of 192 to 207 of that uint256. In the
* above table counter XX is at logical index 22. It will convert to a physical index of 1 in the array and
* then to bit-index 128 to 143 of uint256[1].
* then to bit-index 96 to 111 of uint256[1].
*/
library Uint16Array {
/**
Expand Down Expand Up @@ -65,7 +65,7 @@ library Uint16Array {
// Right-shift the index by 4. This truncates the first 4 bits (bit-index) leaving us with the index
// into the array.
uint256 element = index >> 4;
// Mask out the first 4 bytes of the logical index to give us the bit-index.
// Mask out the first 4 bits of the logical index to give us the bit-index.
uint8 inside = uint8(index) & 0x0F;
// find the element in the array, shift until its bit index and mask to only take the first 16 bits.
return uint16((self.data[element] >> (16 * inside)) & 0xFFFF);
Expand Down

0 comments on commit 8db1e49

Please sign in to comment.