Skip to content
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

orAny [hl], [hl] has unexpected behavior #16

Closed
ISSOtm opened this issue May 8, 2019 · 2 comments
Closed

orAny [hl], [hl] has unexpected behavior #16

ISSOtm opened this issue May 8, 2019 · 2 comments

Comments

@ISSOtm
Copy link
Contributor

ISSOtm commented May 8, 2019

This line makes orAny [hl], [hl] only read from memory once, which is not expected behavior.
This could be useful for reading STAT, for example, or acknowledging by polling memory (some mappers, including custom, work this way)

@joeldipops
Copy link
Owner

Considering several solutions for this none of which is satisfying.

  • I could just remove the orAny macro (and its cousins andAny and xorAny) altogether, since the behaviour can be misleading, but I think it still has value.

  • I could remove the special case and document the fact that it will be inefficient if comparing something to itself. I don't favour this. I have a feeling that it's more likely orAny will be used outside of the cases mentioned so decreasing the risk of unnecessary cycles would still be an improvement.

  • I could keep the special case and document when NOT to use it. This seems ok, but documentation can be easily missed or ignored.

  • I could keep the special case and document it along with a WARN message. This would make it much more likely to be seen, but would pepper working code with warnings and that's not great. Still I think this is what I'll go with for now. I could even write a subsystem to suppress understood warnings, given my tendency to over-engineer.

@joeldipops
Copy link
Owner

joeldipops commented Jun 13, 2019

Have added a warning message to these and provided a config setting to suppress warnings.

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

No branches or pull requests

2 participants