mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-19 14:25:13 +03:00
Convert to CommonJS Modules
This commit is contained in:
parent
7df8253099
commit
91f1699659
100 changed files with 9685 additions and 3735 deletions
34
js/bitHelper.js
Normal file
34
js/bitHelper.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
'use strict'
|
||||
|
||||
var BitHelper = function() {
|
||||
|
||||
var self = {};
|
||||
|
||||
self.highByte = function (num) {
|
||||
return num >> 8;
|
||||
}
|
||||
|
||||
self.lowByte = function (num) {
|
||||
return 0x00FF & num;
|
||||
}
|
||||
|
||||
self.specificByte = function (num, pos) {
|
||||
return 0x000000FF & (num >> (8 * pos));
|
||||
}
|
||||
|
||||
self.bit_check = function (num, bit) {
|
||||
return ((num >> bit) % 2 != 0);
|
||||
}
|
||||
|
||||
self.bit_set = function (num, bit) {
|
||||
return num | 1 << bit;
|
||||
}
|
||||
|
||||
self.bit_clear = function(num, bit) {
|
||||
return num & ~(1 << bit);
|
||||
}
|
||||
|
||||
return self;
|
||||
}();
|
||||
|
||||
module.exports = BitHelper;
|
Loading…
Add table
Add a link
Reference in a new issue