wip: big refactor
This commit is contained in:
10
converters.js
Normal file
10
converters.js
Normal file
@@ -0,0 +1,10 @@
|
||||
export const bitsToInt = (bits, bitLength) => {
|
||||
parseInt(bits
|
||||
// only grab the bits we need
|
||||
.slice(0, bitLength)
|
||||
// combine into string
|
||||
.join('')
|
||||
// Assume missing bits were zeros
|
||||
.padEnd(bitLength, '0')
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user