modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo
Other
22.11k stars 2.54k forks source link

[Feature Request] [stdlib] `bit` module needs to be completed #2862

Open LJ-9801 opened 1 month ago

LJ-9801 commented 1 month ago

Review Mojo's priorities

What is your request?

There are several things that need to be done for the bit module after #2859 is merged. First of all, bit_reverse, byte_reverse and pop_count all needs to be implemented for type Int. These are probably just simple wrapper around LLVM IR. After pop_count is implemented, we can refactor out both implementation of has_single_bit as mentioned in the discussion in #2859. Second of all, we need to complete all the tests cases for the rest of the bit module.

What is your motivation for this change?

complete entire bit module.

Any other details?

No response

### Tasks
- [ ] implement `bit_reverse`, `byte_swap`, `pop_count` in Int type
- [ ] use `popcount() == 1` to determine `is_power_of_two`
JoeLoser commented 1 month ago

Can we create sub-issues here for the remaining work (if any) so we know what remains? That will make it easy for other contributors too. Thanks!

CC: @laszlo too

LJ-9801 commented 1 month ago

@JoeLoser just updated the task list. @laszlokindrat is there any other thing that needs to be done?

laszlokindrat commented 3 weeks ago

@laszlokindrat is there any other thing that needs to be done?

Not that I can think of right now. Thanks for working on this.