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.3.1 node_modules/bower/node_modules/mout/number/toUInt31.js
trusty-festivity-extension-2.3.0 node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/mout/number/toUInt31.js