123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 'use strict';
- var $TypeError = require('es-errors/type');
- module.exports = function BigIntBitwiseOp(op, x, y) {
- if (op !== '&' && op !== '|' && op !== '^') {
- throw new $TypeError('Assertion failed: `op` must be `&`, `|`, or `^`');
- }
- if (typeof x !== 'bigint' || typeof y !== 'bigint') {
- throw new $TypeError('`x` and `y` must be BigInts');
- }
- if (op === '&') {
- return x & y;
- }
- if (op === '|') {
- return x | y;
- }
- return x ^ y;
-
- };
|