(val: int, len: int, bb: Array<bit>)
| 693 | // Appends the given number of low-order bits of the given value |
| 694 | // to the given buffer. Requires 0 <= len <= 31 and 0 <= val < 2^len. |
| 695 | function appendBits(val: int, len: int, bb: Array<bit>): void { |
| 696 | if (len < 0 || len > 31 || val >>> len != 0) |
| 697 | throw new RangeError("Value out of range"); |
| 698 | for (let i = len - 1; i >= 0; i--) // Append bit by bit |
| 699 | bb.push((val >>> i) & 1); |
| 700 | } |
| 701 | |
| 702 | |
| 703 | // Returns true iff the i'th bit of x is set to 1. |
no outgoing calls
no test coverage detected
searching dependent graphs…