Sha256: 30152086e8682fac76a2b63cca9ae89238dfa88b0b6b81e79bb689db2879c017

Contents?: true

Size: 476 Bytes

Versions: 69

Compression:

Stored size: 476 Bytes

Contents

var MAX_INT = require('./MAX_INT');

    /**
     * "Convert" value into an 31-bit unsigned integer (since 1 bit is used for sign).
     * IMPORTANT: value wil wrap at 2^31, if negative will return 0.
     */
    function toUInt31(val){
        // we do not use lang/toNumber because of perf and also because it
        // doesn't break the functionality
        return (val <= 0)? 0 : (val > MAX_INT? ~~(val % (MAX_INT + 1)) : ~~val);
    }

    module.exports = toUInt31;


Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/mout/number/toUInt31.js