瀏覽代碼

Can now get the direct bit value with the new .val() method.

master
Bryan Miller 5 年之前
父節點
當前提交
004d99d851
共有 1 個檔案被更改,包括 4 行新增0 行删除
  1. +4
    -0
      src/utils/bitman.js

+ 4
- 0
src/utils/bitman.js 查看文件



var bitman = {}; var bitman = {};


bitman.val = function(num, bit){
return (bitman.isOn(num, bit)) ? 1 : 0;
}

bitman.isOn = function(num, bit){ bitman.isOn = function(num, bit){
return ((num>>bit) % 2) !== 0; return ((num>>bit) % 2) !== 0;
} }

Loading…
取消
儲存