Skip to content

fix: Make $[], sizeof($) and addressof($) respect the current section + added tests for it - #244

Merged
WerWolv merged 4 commits into
WerWolv:masterfrom
ddmitv:fix-dollar-operator-and-add-tests
Aug 25, 2026
Merged

fix: Make $[], sizeof($) and addressof($) respect the current section + added tests for it#244
WerWolv merged 4 commits into
WerWolv:masterfrom
ddmitv:fix-dollar-operator-and-add-tests

Conversation

@ddmitv

@ddmitv ddmitv commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Before this fix, $[address] returned a byte from the main section, regardless of the current active section it's being executed in. I'm pretty sure this is a bug because std::mem::read_unsigned (and other functions in std::mem) actually respects the current section (see here). sizeof($) and addressof($) were also fixed. They now work exactly the same way as std::mem::size and std::mem::base_address.

Additionally, I added tests for the $ operator since it didn't have its own tests before and I wasn't sure where to put tests for $[], sizeof($) and addressof($). Small note: #pragma base_address doesn't exist here and I'm not sure how to change base address without it, so addressof($) is not actually being tested with a modified base address.

@WerWolv
WerWolv merged commit 2751a95 into WerWolv:master Aug 25, 2026
5 checks passed
@WerWolv

WerWolv commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants