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

Function add_one

ciphercore-base/src/ops/long_division.rs:320–337  ·  view source on GitHub ↗
(binary_num: Node)

Source from the content-addressed store, hash-verified

318}
319
320fn add_one(binary_num: Node) -> Result<Node> {
321 let dims = binary_num.get_type()?.get_dimensions();
322 let bits = dims[dims.len() - 1];
323 let g = binary_num.get_graph();
324 let binary_one = g.concatenate(
325 vec![
326 g.ones(array_type(vec![1], BIT))?,
327 g.zeros(array_type(vec![bits - 1], BIT))?,
328 ],
329 0,
330 )?;
331 g.custom_op(
332 CustomOperation::new(BinaryAdd {
333 overflow_bit: false,
334 }),
335 vec![binary_num, binary_one],
336 )
337}
338
339fn invert_bits(binary_num: Node) -> Result<Node> {
340 let g = binary_num.get_graph();

Callers 2

adjust_negativeFunction · 0.85
negativeFunction · 0.85

Calls 5

get_dimensionsMethod · 0.80
concatenateMethod · 0.80
get_typeMethod · 0.45
get_graphMethod · 0.45
custom_opMethod · 0.45

Tested by

no test coverage detected