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

CTZ can be implemented in terms of CLZ #168

Open
DemiMarie opened this issue Dec 12, 2018 · 4 comments
Open

CTZ can be implemented in terms of CLZ #168

DemiMarie opened this issue Dec 12, 2018 · 4 comments

Comments

@DemiMarie
Copy link

CTZ can be implemented in terms of CLZ and some form of bit swapping operation. I suspect that there is a faster way of doing this.

@jakelang
Copy link
Member

@DemiMarie I think this issue is out of scope. Ewasm does not intend to make any changes to the WebAssembly specification.
Even then, it is up to the implementer of the Wasm virtual machine if they want to optimize CTZ by implementing it in terms of CLZ natively.

@DemiMarie
Copy link
Author

@jakelang I was thinking of the gas prices that Ewasm specifies for these operations, which should be representative of their computational consts on actual hardware.

@axic
Copy link
Member

axic commented Dec 12, 2018

For both ctz/clz we have decided to take a fairly naive implementation for calculating the cost to suit all VM implementations.

@jakelang
Copy link
Member

jakelang commented Dec 12, 2018

@DemiMarie I think this would then be more of a research topic, in that someone should look into whether the major WASM implementations have this optimization.

Edit: I am guessing most (compiled) implementations have it, as modern optimizing compilers may introduce such optimizations during compilation even if not specified in the source.

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

3 participants