aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/block.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/block.rs b/src/block.rs
index 0e64bbe..ce2d22c 100644
--- a/src/block.rs
+++ b/src/block.rs
@@ -72,7 +72,9 @@ impl Block {
/// This corresponds to X10* in the paper.
pub fn pad(&self, length: usize) -> Block {
assert!(length <= 127);
- Block::from_int(self.to_int() | (1 << (127 - length)))
+ let mut result = *self;
+ result[length / 8] |= 1 << (7 - length % 8);
+ result
}
/// Clip the block by setting all bits beyond the given length to 0.