Skip to content
Subhajit Sahu edited this page Jun 6, 2020 · 15 revisions

Gets bits as per mask. 🏃 📼 📦 🌔 📒

bit.getAs(x, m);
// x: an int32
// m: bit mask
const bit = require('extra-bit');

bit.getAs(6, 4);
// 0 (110,100 => 100)

bit.getAs(6, 7);
// 1 (110,111 => 110)

bit.getAs(6, 5);
// 1 (110,101 => 100)

references

Clone this wiki locally