Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Improve table docs section #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Philogy
Copy link

@Philogy Philogy commented Aug 9, 2022

Explain that __tablestart and __tablesize also work for code tables. Furthermore expand the code table example to make its usage in the context clearer

Explain that `__tablestart` and `__tablesize` also work for code tables. Furthermore expand the code table example to make its usage in the context clearer
@netlify
Copy link

netlify bot commented Aug 9, 2022

Deploy Preview for huffdocs ready!

Name Link
🔨 Latest commit a530c8c
🔍 Latest deploy log https://app.netlify.com/sites/huffdocs/deploys/62f2d504437f060008769768
😎 Deploy Preview https://deploy-preview-47--huffdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@Maddiaa0 Maddiaa0 requested a review from clabby August 15, 2022 20:32
@Maddiaa0
Copy link
Member

Looks like a good improvement thank you. @clabby wdyt

Copy link
Member

@clabby clabby left a 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
}
Copy link
Member

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.

Copy link
Author

@Philogy Philogy Aug 17, 2022

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants