This website works better with JavaScript.
Home
Explore
Help
Sign In
ObsidianBlk
/
F8
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Can now get the direct bit value with the new .val() method.
master
Bryan Miller
5 years ago
parent
30132b152e
commit
004d99d851
1 changed files
with
4 additions
and
0 deletions
Split View
Show Diff Stats
+4
-0
src/utils/bitman.js
+ 4
- 0
src/utils/bitman.js
View File
@@ -1,6 +1,10 @@
var bitman = {};
bitman.val = function(num, bit){
return (bitman.isOn(num, bit)) ? 1 : 0;
}
bitman.isOn = function(num, bit){
return ((num>>bit) % 2) !== 0;
}
Write
Preview
Loading…
Cancel
Save