Skip to content

feat(u4): add nibble pair byte adapter - #80

Open
brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/u4-nibbles-to-byte
Open

brenorb wants to merge 1 commit into
solving-bitcoin:mainfrom
brenorb:feat/u4-nibbles-to-byte

Conversation

@brenorb

@brenorb brenorb commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • add u4_nibbles_to_byte to pack a high/low nibble pair into one byte
  • provide checked and unchecked forms with explicit stack contracts
  • reject negative and 16-valued inputs in checked mode
  • record script, witness, stack, and static-opcode metrics

Validation

  • cargo test --locked arithmetic::u4::bits::tests::exhaustive_nibble_pairs_pack_to_bytes
  • cargo test --locked arithmetic::u4::bits::tests::checked_nibble_pair_rejects_malformed_inputs
  • cargo test --locked --test primitive_metrics
  • python3 tools/kb.py validate
  • cargo fmt --check
  • git diff --check

The full repository test suite was intentionally not run; the focused primitive and metric checks pass. Dynamic opcode counting is unavailable in the local executor, so the documentation reports static non-push counts.

@brenorb
brenorb force-pushed the feat/u4-nibbles-to-byte branch from 3f07fea to 39a6c69 Compare September 11, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant