diff options
| author | Chris Cole <[email protected]> | 2017-03-01 11:24:11 -0500 |
|---|---|---|
| committer | Chris Cole <[email protected]> | 2017-03-01 11:24:11 -0500 |
| commit | bf21ff5f80a94a4633fa00143997b98bf39e5e91 (patch) | |
| tree | b1f89e689a02ca981876cdd5c2b31f498693701d /openssl/src | |
| parent | Fix dangling reference (diff) | |
| download | rust-openssl-bf21ff5f80a94a4633fa00143997b98bf39e5e91.tar.xz rust-openssl-bf21ff5f80a94a4633fa00143997b98bf39e5e91.zip | |
Fix Shr trait impl for BigNum: was using shl
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/bn.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/openssl/src/bn.rs b/openssl/src/bn.rs index 9557b5bb..5cc27862 100644 --- a/openssl/src/bn.rs +++ b/openssl/src/bn.rs @@ -465,7 +465,7 @@ impl BigNumRef { /// Returns a big-endian byte vector representation of the absolute value of `self`. /// - /// `self` can be recreated by using `new_from_slice`. + /// `self` can be recreated by using `from_slice`. /// /// ``` /// # use openssl::bn::BigNum; @@ -874,7 +874,7 @@ impl<'a> Shr<i32> for &'a BigNum { type Output = BigNum; fn shr(self, n: i32) -> BigNum { - self.deref().shl(n) + self.deref().shr(n) } } @@ -926,6 +926,14 @@ mod tests { } #[test] + fn test_shift() { + let a = BigNum::from_u32(909829283).unwrap(); + use std::ops::{Shl, Shr}; + + assert!(a == a.shl(1).shr(1)); + } + + #[test] fn test_prime_numbers() { let a = BigNum::from_u32(19029017).unwrap(); let mut p = BigNum::new().unwrap(); |