support target wasm32-wasip1
when I run the cmd
cargo +stable build --target wasm32-wasip1 --no-default-features
It outputs this information
| pub const BITS_PER_L1_ENTRY: usize = 1<<32;
| ^^^^^ attempt to shift left by `32_i32`, which would overflow
Compiling form_urlencoded v1.2.1
Compiling sha3 v0.10.8
Compiling eyre v0.6.12
note: erroneous constant encountered
--> /home/ysg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitm-0.4.2/src/rank_select/select.rs:156:31
|
156 | *rank -= i as usize * BITS_PER_L1_ENTRY - unsafe{l1ranks.get_unchecked(i)};
| ^^^^^^^^^^^^^^^^^
note: erroneous constant encountered
--> /home/ysg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitm-0.4.2/src/rank_select/selec
Do we have plan to support wasm32-wasip1 ?
The problem is technically easy to solve, but requires deep thinking about how the API should look like. In wasm32 usize has 4 bytes. My structures (bitmaps) support 2 to the power of 64 indexes. So I would have to use u64 instead of usize to index them. Moreover, I use arrays and vectors underneath, so when their indexes are 32 bits, I can't implement full 64 bit indexes in bitmaps.
As a workaround, you can try compiling with the wasm64-unknown-unknown target. It uses the (for now experimental) memory64 wasm extension.
I work on 32 bit support in 32bits branch. The code should compile and work, but I have no way to test it at the moment. The API is preserved, i.e. usize is used for indexing and counting bits. This means that (for a 32 bit usize) their number cannot exceed 2 to the power of 32.
https://github.com/beling/bsuccinct-rs/tree/32bits
Thanks for your help!
Now everything in 32bits branch seems to compile and pass the test on 32 bit platform (I've tested with i686-unknown-linux-gnu target). Can you check for your target platform(s)?
Yeah, Thank you for your help. I have tried with 32 bit platform.
Thanks. I will merge 32bits into main in the next few days and release new versions of crates to cargo.