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

Support 32 bit architectures #478

Merged
merged 6 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:
cargo build --release -p test-no-std --features compose-macros,
cargo build --release -p test-no-std --features node-api,

# Test for 32 bit and wasm32-unknown-unknown compatibility
cargo build --target wasm32-unknown-unknown --no-default-features,

# Clippy
cargo clippy --workspace --exclude test-no-std -- -D warnings,
cargo clippy --all-features --examples -- -D warnings,
Expand Down
2 changes: 2 additions & 0 deletions node-api/src/decoder/bit_sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub fn get_bitsequence_details(
TypeDef::Primitive(TypeDefPrimitive::U8) => Some(BitOrderTy::U8),
TypeDef::Primitive(TypeDefPrimitive::U16) => Some(BitOrderTy::U16),
TypeDef::Primitive(TypeDefPrimitive::U32) => Some(BitOrderTy::U32),
#[cfg(target_pointer_width = "64")]
TypeDef::Primitive(TypeDefPrimitive::U64) => Some(BitOrderTy::U64),
_ => None,
}
Expand All @@ -77,5 +78,6 @@ pub enum BitOrderTy {
U8,
U16,
U32,
#[cfg(target_pointer_width = "64")]
U64,
}
2 changes: 2 additions & 0 deletions node-api/src/decoder/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ fn decode_bit_sequence_value(
(BitOrderTy::U16, BitStoreTy::Msb0) => to_bit_sequence(BitVec::<u16, Msb0>::decode(data)?),
(BitOrderTy::U32, BitStoreTy::Lsb0) => to_bit_sequence(BitVec::<u32, Lsb0>::decode(data)?),
(BitOrderTy::U32, BitStoreTy::Msb0) => to_bit_sequence(BitVec::<u32, Msb0>::decode(data)?),
#[cfg(target_pointer_width = "64")]
(BitOrderTy::U64, BitStoreTy::Lsb0) => to_bit_sequence(BitVec::<u64, Lsb0>::decode(data)?),
#[cfg(target_pointer_width = "64")]
(BitOrderTy::U64, BitStoreTy::Msb0) => to_bit_sequence(BitVec::<u64, Msb0>::decode(data)?),
};

Expand Down
2 changes: 2 additions & 0 deletions node-api/src/decoder/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ fn encode_bitsequence_value<T>(
(BitOrderTy::U32, BitStoreTy::Lsb0) => {
bools.into_iter().collect::<BitVec<u32, Lsb0>>().encode_to(bytes);
},
#[cfg(target_pointer_width = "64")]
(BitOrderTy::U64, BitStoreTy::Lsb0) => {
bools.into_iter().collect::<BitVec<u64, Lsb0>>().encode_to(bytes);
},
Expand All @@ -563,6 +564,7 @@ fn encode_bitsequence_value<T>(
(BitOrderTy::U32, BitStoreTy::Msb0) => {
bools.into_iter().collect::<BitVec<u32, Msb0>>().encode_to(bytes);
},
#[cfg(target_pointer_width = "64")]
(BitOrderTy::U64, BitStoreTy::Msb0) => {
bools.into_iter().collect::<BitVec<u64, Msb0>>().encode_to(bytes);
},
Expand Down