Skip to content

Commit

Permalink
add shift function
Browse files Browse the repository at this point in the history
  • Loading branch information
rpitasky committed Sep 2, 2024
1 parent 0c9f3cc commit e3d8d53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ impl Float {
Err(FloatError::Overflow)
}
}

pub fn shift(&self, delta: i8) -> Float {
Float {
flags: self.flags,
mantissa: self.mantissa,
exponent: (self.exponent as i8).wrapping_add(delta) as u8
}
}
}

impl Float {
Expand Down

0 comments on commit e3d8d53

Please sign in to comment.