123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- 'use strict';
- var GetIntrinsic = require('get-intrinsic');
- var $TypeError = GetIntrinsic('%TypeError%');
- var Type = require('./Type');
- module.exports = function BigIntBitwiseOp(op, x, y) {
- if (op !== '&' && op !== '|' && op !== '^') {
- throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`');
- }
- if (Type(x) !== 'BigInt' || Type(y) !== 'BigInt') {
- throw new $TypeError('`x` and `y` must be BigInts');
- }
- if (op === '&') {
- return x & y;
- }
- if (op === '|') {
- return x | y;
- }
- return x ^ y;
-
- };
|