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

#define like in c or c++ #127

Open
truebluepl opened this issue Sep 11, 2024 · 1 comment
Open

#define like in c or c++ #127

truebluepl opened this issue Sep 11, 2024 · 1 comment

Comments

@truebluepl
Copy link

Hello Georg,

is there any way to define a kind of macro like in c or c++?

For example I would like find closest power of two of any value.
So the code is:

v = v - 1
v = v | v>>1
v = v | v>>2
v = v | v>>4
v = v + 1

I can't (maybe I'm wrong) use macro like:

!macro ClosestPowerOfTwo v
v = v - 1
v = v | v>>1
v = v | v>>2
v = v | v>>4
v = v + 1
!end

and put in the source:
and #+ClosestPowerOfTwo 12

@GeorgRottensteiner
Copy link
Owner

Currently not unfortunately.
Macros are at the moment doing dumb replacement of the full caller line, so this wouldn't work out.

I have to figure out how to implement the above somehow, but that may take a while.

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