-
Notifications
You must be signed in to change notification settings - Fork 1
getAs
Subhajit Sahu edited this page Jul 25, 2022
·
15 revisions
Get bits as per mask.
getAs(x, m)
// x: an int32
// m: bit mask
const xbit = require('extra-bit');
xbit.getAs(6, 4);
// → 4 (110,100 ⇒ 100)
xbit.getAs(6, 7);
// → 6 (110,111 ⇒ 110)
xbit.getAs(6, 5);
// → 4 (110,101 ⇒ 100)