Skip to content

Commit

Permalink
fix BITS to use u32
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaldino committed Mar 1, 2024
1 parent 2442cec commit b74c374
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ macro_rules! define_unsigned {
impl $name {
pub const MAX: Self = $name(((1 as $type) << $bits) -1 );
pub const MIN: Self = $name(0);
pub const BITS: usize = $bits;
pub const BITS: u32 = $bits;

fn mask(self) -> Self {
$name(self.0 & ( ((1 as $type) << $bits).overflowing_sub(1).0))
Expand All @@ -68,7 +68,7 @@ macro_rules! define_signed {
impl $name {
pub const MAX: Self = $name(((1 as $type) << ($bits - 1)) - 1);
pub const MIN: Self = $name(-((1 as $type) << ($bits - 1)));
pub const BITS: usize = $bits;
pub const BITS: u32 = $bits;

fn mask(self) -> Self {
if ( self.0 & (1<<($bits-1)) ) == 0 {
Expand Down

0 comments on commit b74c374

Please sign in to comment.