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:
562 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var $TypeError = require('es-errors/type');
|
---|
4 |
|
---|
5 | var ToInt32 = require('../ToInt32');
|
---|
6 | var ToUint32 = require('../ToUint32');
|
---|
7 | var modulo = require('../modulo');
|
---|
8 |
|
---|
9 | // https://262.ecma-international.org/12.0/#sec-numeric-types-number-leftShift
|
---|
10 |
|
---|
11 | module.exports = function NumberLeftShift(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.