"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/es5-ext/math/imul/shim.js" (8 Feb 2018, 497 Bytes) of package /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 /* eslint no-bitwise: "off" */
    2 
    3 // Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
    4 //         /Global_Objects/Math/imul
    5 
    6 "use strict";
    7 
    8 module.exports = function (val1, val2) {
    9     var xh = (val1 >>> 16) & 0xffff
   10       , xl = val1 & 0xffff
   11       , yh = (val2 >>> 16) & 0xffff
   12       , yl = val2 & 0xffff;
   13 
   14     // The shift by 0 fixes the sign on the high part
   15     // the final |0 converts the unsigned value into a signed value
   16     return (xl * yl + ((xh * yl + xl * yh) << 16 >>> 0)) | 0;
   17 };