@extra-bit/parity.min

Finds n-bit parity.

Usage no npm install needed!

<script type="module">
  import extraBitParityMin from 'https://cdn.skypack.dev/@extra-bit/parity.min';
</script>

README

Finds n-bit parity. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Similar: count, parity.

This is part of package extra-bit.

This is browserified, minified version of @extra-bit/parity.
It is exported as global variable bit_parity.
CDN: unpkg, jsDelivr.


bit.parity(x, [n]);
// x: an int32
// n: number of bits (1)
const bit = require("extra-bit");

bit.parity(7);
// 1 (1,1,1 ⇒ 1)

bit.parity(5);
// 0 (1,0,1 ⇒ 0)

bit.parity(8, 2);
// 2 (10,00 ⇒ 10)

bit.parity(63, 4);
// 12 (11,1111 ⇒ 1100)


References