source: imaps-frontend/node_modules/es-abstract/2022/Number/signedRightShift.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 576 bytes
Line 
1'use strict';
2
3var $TypeError = require('es-errors/type');
4
5var ToInt32 = require('../ToInt32');
6var ToUint32 = require('../ToUint32');
7var modulo = require('../modulo');
8
9// https://262.ecma-international.org/12.0/#sec-numeric-types-number-signedRightShift
10
11module.exports = function NumberSignedRightShift(x, y) {
12 if (typeof x !== 'number' || typeof y !== 'number') {
13 throw new $TypeError('Assertion failed: `x` and `y` arguments must be Numbers');
14 }
15
16 var lnum = ToInt32(x);
17 var rnum = ToUint32(y);
18
19 var shiftCount = modulo(rnum, 32);
20
21 return lnum >> shiftCount;
22};
Note: See TracBrowser for help on using the repository browser.