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

lastBit not being set correctly for GDC? #21

Open
wilsonk opened this issue Jun 27, 2023 · 0 comments
Open

lastBit not being set correctly for GDC? #21

wilsonk opened this issue Jun 27, 2023 · 0 comments

Comments

@wilsonk
Copy link

wilsonk commented Jun 27, 2023

Just wondering if this bit of code in util.d is correct?

/* Get the first bit set */
version (LDC) int firstBit(ulong b) {return cast (int) llvm_cttz(b, true);}
else version (GDC) alias firstBit = __builtin_ctz;
else alias firstBit = bsf;

/* Get the last bit set */
version (GDC) alias firstBit = __builtin_clz;
else alias lastBit = bsr;

The second to last line resets firstBit and doesn't actually set lastBit for GDC. Seems off to me :)

May not affect much as it seems to only be used to resize tables, but it may affect accuracy, if used in the future I suppose.

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

1 participant