MCPcopy Create free account
hub / github.com/argumentcomputer/ix / bitvec_to_nat_expr

Method bitvec_to_nat_expr

crates/kernel/src/whnf.rs:2560–2573  ·  view source on GitHub ↗
(
    &mut self,
    width: &KExpr<M>,
    value: &KExpr<M>,
  )

Source from the content-addressed store, hash-verified

2558 let mut total = base_val.0;
2559 total += parts.major.0;
2560 total += offset;
2561 let result = Nat(total);
2562 let blob_addr = Address::hash(&result.to_le_bytes());
2563 Ok(Some(KExpr::nat(result, blob_addr)))
2564 }
2565
2566 fn nat_rec_literal_parts(
2567 &mut self,
2568 e: &KExpr<M>,
2569 ) -> Result<Option<NatRecLiteralParts<M>>, TcError<M>> {
2570 let (head, spine) = collect_app_spine(e);
2571 let ExprData::Const(id, _, _) = head.data() else {
2572 return Ok(None);
2573 };
2574 if id.addr != self.prims.nat_rec.addr {
2575 return Ok(None);
2576 }

Callers 1

try_reduce_bitvec_ultMethod · 0.80

Calls 5

internMethod · 0.80
cnstFunction · 0.70
appFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected