"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/es5-ext/math/imul/shim.js" (7 Feb 2017, 445 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 // Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
    2 //         /Global_Objects/Math/imul
    3 
    4 'use strict';
    5 
    6 module.exports = function (x, y) {
    7     var xh  = (x >>> 16) & 0xffff, xl = x & 0xffff
    8       , yh  = (y >>> 16) & 0xffff, yl = y & 0xffff;
    9 
   10     // the shift by 0 fixes the sign on the high part
   11     // the final |0 converts the unsigned value into a signed value
   12     return ((xl * yl) + (((xh * yl + xl * yh) << 16) >>> 0) | 0);
   13 };