-
Notifications
You must be signed in to change notification settings - Fork 34
Improve table docs section #47
base: main
Are you sure you want to change the base?
Conversation
Explain that `__tablestart` and `__tablesize` also work for code tables. Furthermore expand the code table example to make its usage in the context clearer
✅ Deploy Preview for huffdocs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Looks like a good improvement thank you. @clabby wdyt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great spot! Sorry for the delay- the review request got buried in my notifications 😅
mstore // [size] | ||
returndatasize // [0, size] | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this works as intended- maybe something like this?
#define macro MAIN() = {
__tablesize(CODE_TABLE) // [table_size]
__tablestart(CODE_TABLE) // [table_start, table_size]
returndatasize // [0x00, table_start, table_size]
codecopy // []
msize returndatasize // [0x00, 0x20]
return // []
}
Also wondering if we should use tricks like returndatasize
here- idea is to have easily readable (er, as easily readible as we can manage) code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah my bad, replace mstore
with codecopy
in my example and it'll work (compiled and tested this time), your example would pad the return with 0-bytes but it works too.
When it comes to tricks like returndatasize
I feel like they should at least be in the docs somewhere but I agree that this might not be the best place. My thought was that if someone sees that and actually thinks to question it they'll learn as they research / ask about it.
Explain that
__tablestart
and__tablesize
also work for code tables. Furthermore expand the code table example to make its usage in the context clearer