Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
index: Add rightShift to BigInt
Browse files Browse the repository at this point in the history
  • Loading branch information
evaporei authored and leoyvens committed Feb 8, 2021
1 parent 4dfd74c commit c752276
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ declare namespace bigInt {
function bitOr(x: BigInt, y: BigInt): BigInt
function bitAnd(x: BigInt, y: BigInt): BigInt
function leftShift(x: BigInt, bits: u8): BigInt
function rightShift(x: BigInt, bits: u8): BigInt
}

/** Host interface for BigDecimal */
Expand Down Expand Up @@ -581,6 +582,11 @@ export class BigInt extends Uint8Array {
return bigInt.leftShift(this, bits)
}

@operator('>>')
rightShift(bits: u8): BigInt {
return bigInt.rightShift(this, bits)
}

/// Limited to a low exponent to discourage creating a huge BigInt.
pow(exp: u8): BigInt {
return bigInt.pow(this, exp)
Expand Down

0 comments on commit c752276

Please sign in to comment.