-
Notifications
You must be signed in to change notification settings - Fork 1
set
Subhajit Sahu edited this page Feb 2, 2021
·
15 revisions
bit.set(x, i, [f]);
// x: an int32
// i: bit index
// f: bit value (1)
const bit = require('extra-bit');
bit.set(6, 0, 1);
// 7 (110,0,1 => 111)
bit.set(6, 2, 1);
// 6 (110,2,1 => 110)
bit.set(6, 2, 0);
// 2 (110,2,0 => 010)