MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / shru

Method shru

projects/JavaScript/proto/int64.js:1774–1792  ·  view source on GitHub ↗

* This UInt64 with bits shifted to the right by the given amount with filling zeros to the left * @this {!UInt64} * @param {Int64|UInt64|number} numBits Number of bits * @returns {!UInt64} Shifted result value

(numBits)

Source from the content-addressed store, hash-verified

1772 * @returns {!UInt64} Shifted result value
1773 */
1774 shru (numBits) {
1775 if (Int64.isInt64(numBits) || UInt64.isUInt64(numBits)) {
1776 numBits = numBits.toInt32()
1777 }
1778 numBits &= 63
1779 if (numBits === 0) {
1780 return this
1781 } else {
1782 let high = this.high
1783 if (numBits < 32) {
1784 let low = this.low
1785 return UInt64.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits)
1786 } else if (numBits === 32) {
1787 return UInt64.fromBits(high, 0)
1788 } else {
1789 return UInt64.fromBits(high >>> (numBits - 32), 0)
1790 }
1791 }
1792 }
1793}
1794
1795Object.defineProperty(UInt64.prototype, '__isUInt64__', { value: true })

Callers 1

divMethod · 0.95

Calls 4

isInt64Method · 0.80
isUInt64Method · 0.80
toInt32Method · 0.45
fromBitsMethod · 0.45

Tested by

no test coverage detected