MCPcopy Create free account
hub / github.com/ciphermodelabs/ciphercore / shrink

Method shrink

ciphercore-base/src/ops/adder.rs:168–181  ·  view source on GitHub ↗
(&self, overflow_bit: bool)

Source from the content-addressed store, hash-verified

166 }
167
168 fn shrink(&self, overflow_bit: bool) -> Result<CarryNode> {
169 let bit_len = self.bit_len()? as i64;
170
171 let next_lvl_bits = if overflow_bit {
172 bit_len / 2
173 } else {
174 (bit_len - 1) / 2
175 };
176 let use_bits = next_lvl_bits * 2;
177 let lower = self.sub_slice(0, use_bits)?;
178 let higher = self.sub_slice(1, use_bits)?;
179
180 lower.join(&higher)
181 }
182
183 /// assumes `bit_len` is the same for `self` and `rhs`
184 fn join(&self, rhs: &Self) -> Result<Self> {

Callers 1

calculate_carry_bitsFunction · 0.45

Calls 3

bit_lenMethod · 0.80
sub_sliceMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected