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

[stdlib] Implement missing functions in the bit module #2682

Closed
laszlokindrat opened this issue May 16, 2024 · 4 comments
Closed

[stdlib] Implement missing functions in the bit module #2682

laszlokindrat opened this issue May 16, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers mojo-repo Tag all issues with this label [stdlib] core-library-q2-2024

Comments

@laszlokindrat
Copy link
Contributor

For example: bit_ceil, bit_floor, has_single_bit, and others. The immediate goal is to achieve (or get pretty close to) parity with Cpp's <bit>. We shouldn't blindly follow the naming, and we can deviate from or extend some of these APIs slightly if we have a good reason to. Many of these functions might be simple wrappers around intrinsics.

See comment: 3f9fa05#diff-20568bce7de07632ece5bf3e933c7e2eec19706a949dcae48ddd4299309ddd10R249

@laszlokindrat laszlokindrat added enhancement New feature or request good first issue Good for newcomers mojo-repo Tag all issues with this label labels May 16, 2024
@laszlokindrat laszlokindrat changed the title [stdlib] Implement missing functions in thebit module [stdlib] Implement missing functions in the bit module May 16, 2024
@LJ-9801
Copy link
Contributor

LJ-9801 commented May 16, 2024

Can I take a look into this? May use this issue to track all the PRs.

@laszlokindrat
Copy link
Contributor Author

Can I take a look into this? May use this issue to track all the PRs.

It's yours now, thank you for working on this! 🎉 Feel free to ping me once you have PRs.

@JoeLoser JoeLoser added the mojo-stdlib Tag for issues related to standard library label May 17, 2024
@LJ-9801
Copy link
Contributor

LJ-9801 commented May 18, 2024

@laszlokindrat some of the originally implemented bit functions such as countl_zero, bit_reverse, countl_zero and etc do not seem to be tested. Are test cases necessary for them? I can open an other PR to add all the test cases for these function if needed.

@laszlokindrat
Copy link
Contributor Author

laszlokindrat commented May 20, 2024

@laszlokindrat some of the originally implemented bit functions such as countl_zero, bit_reverse, countl_zero and etc do not seem to be tested. Are test cases necessary for them?

Yes, they are necessary, but indeed missing.

I can open an other PR to add all the test cases for these function if needed.

That would be highly appreciated, thank you!

@ematejska ematejska removed the mojo-stdlib Tag for issues related to standard library label May 22, 2024
modularbot pushed a commit that referenced this issue May 27, 2024
[External] [stdlib] implement `bit_ceil` and `bit_floor`

fix #2682

Co-authored-by: Jiexiang Liu <80805665+LJ-9801@users.noreply.github.com>
Closes #2736
MODULAR_ORIG_COMMIT_REV_ID: 3599b7ce4aba5d369ffb7e0fc09d1571dfb53f1e
Av1nag pushed a commit to Av1nag/mojo that referenced this issue May 27, 2024
[External] [stdlib] implement `bit_ceil` and `bit_floor`

fix modularml#2682

Co-authored-by: Jiexiang Liu <80805665+LJ-9801@users.noreply.github.com>
Closes modularml#2736
MODULAR_ORIG_COMMIT_REV_ID: 3599b7ce4aba5d369ffb7e0fc09d1571dfb53f1e
Av1nag pushed a commit to Av1nag/mojo that referenced this issue May 27, 2024
[External] [stdlib] implement `bit_ceil` and `bit_floor`

fix modularml#2682

Co-authored-by: Jiexiang Liu <80805665+LJ-9801@users.noreply.github.com>
Closes modularml#2736
MODULAR_ORIG_COMMIT_REV_ID: 3599b7ce4aba5d369ffb7e0fc09d1571dfb53f1e

Signed-off-by: Avinag <udayagiriavinag@gmail.com>
modularbot pushed a commit that referenced this issue May 28, 2024
[External] [stdlib] Implement `has_single_bit`

Implement `has_single_bit` for checking if a value
is an integral power of `2`.

Fixes #2682.

Co-authored-by: Jiexiang Liu <80805665+LJ-9801@users.noreply.github.com>
Closes #2859
MODULAR_ORIG_COMMIT_REV_ID: 15d31fa55f239879d4c4049557e308b85e0eb4f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers mojo-repo Tag all issues with this label [stdlib] core-library-q2-2024
Projects
None yet
Development

No branches or pull requests

4 participants