Michael Amadi
@michaels
92 Following
326 Followers
0 reply
0 recast
2 reactions
0 reply
0 recast
1 reaction
0 reply
0 recast
0 reaction
0 reply
0 recast
1 reaction
7 replies
8 recasts
248 reactions
0 reply
0 recast
2 reactions
1 reply
0 recast
11 reactions
0 reply
0 recast
1 reaction
1 reply
0 recast
12 reactions
0 reply
0 recast
1 reaction
1 reply
1 recast
8 reactions
0 reply
0 recast
2 reactions
```
contract A {
CodeSection huffCode = CodeSection(0x0101e4, 3, 1, 3); // when used in code, huffCode is a constant that holds the code section index of the variable and not the struct defined above.
function b(uint256 _a, uint256 _b, uint256 _c) external view returns(uint256 _d) {
_d = huffCode_a, _b, _c);
}
// OR
function c(uint256 _a, uint256 _b, uint256 _c) external view returns(uint256 _d) {
assembly {
// in inline assembly, huffCode is the code section index of huffCode. The solidity version above does this under the hood.
_d := callf(huffCode, _a, _b, _c)
}
}
}
```
Also since memory is shared between code sections, similar to inline assembly the concept of memory safe code sections would also be a thing. 1 reply
0 recast
2 reactions
1 reply
0 recast
7 reactions
0 reply
0 recast
11 reactions
0 reply
0 recast
1 reaction
1 reply
0 recast
7 reactions
0 reply
0 recast
3 reactions
1 reply
0 recast
8 reactions
0 reply
0 recast
1 reaction