We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
from_u128
BitSignal
1 parent 78f2f96 commit 041a0ecCopy full SHA for 041a0ec
substrate/src/verification/simulation/bits.rs
@@ -49,6 +49,16 @@ impl BitSignal {
49
Self { bits }
50
}
51
52
+ pub fn from_u128(mut value: u128, width: usize) -> Self {
53
+ assert!(width <= 128);
54
+ let mut bits = BitVec::with_capacity(width);
55
+ for _ in 0..width {
56
+ bits.push(value & 1 != 0);
57
+ value >>= 1;
58
+ }
59
+ Self { bits }
60
61
+
62
#[inline]
63
pub fn ones(width: usize) -> Self {
64
Self {
0 commit comments