Skip to content

Commit

Permalink
feat: bits
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Nov 10, 2024
1 parent 5cd5484 commit 7bd7116
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/bits.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function getBit ( value, bit ) {
return ( value & bit ) !== 0
? 1
: 0;
return ( value & ( 2 ** ( bit - 1 ) ) ) === 0
? 0
: 1;
}

export function setBits ( value, mask ) {
Expand Down

0 comments on commit 7bd7116

Please sign in to comment.