-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(store,world): move hooks to bit flags #1527
Conversation
🦋 Changeset detectedLatest commit: 2545542 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
function isEnabled(Hook self, uint8 hookType) internal pure returns (bool) { | ||
// Pick the bitmap encoded in the rightmost byte from the hook and check if the bit at the given hook type is set | ||
return (getBitmap(self) & (1 << uint8(hookType))) != 0; | ||
function isEnabled(Hook self, uint8 hookTypes) internal pure returns (bool) { | ||
return (getBitmap(self) & hookTypes) == hookTypes; |
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.
✨✨✨ so much nicer
|
||
uint8 constant BEFORE_SET_RECORD = 1 << 0; | ||
uint8 constant AFTER_SET_RECORD = 1 << 1; | ||
// TODO: do we need to differentiate between static and dynamic set field? |
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.
cross posting here from discord for context: the "set field" hook is soon replaced with a "splice" hook (see #1510)
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 will be necessary since we'll only have 6 hooks (before/after set, splice, delete) Edit: it's 8 (before/after set, splice static, splice dynamic, delete) but still fits in 8 bit |
closes #1459
TODO: