MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / fromInt32

Method fromInt32

projects/JavaScript/proto/int64.js:114–132  ·  view source on GitHub ↗

* Returns Int64 representing the given 32-bit integer value * @param {number} value 32-bit integer value * @returns {!Int64} The corresponding Int64 value

(value)

Source from the content-addressed store, hash-verified

112 * @returns {!Int64} The corresponding Int64 value
113 */
114 static fromInt32 (value) {
115 value |= 0
116
117 let cache = ((value >= -128) && (value < 128))
118 if (cache) {
119 let cached = Int64Cache[value]
120 if (cached) {
121 return cached
122 }
123 }
124
125 let result = Int64.fromBits(value, (value < 0) ? -1 : 0)
126
127 if (cache) {
128 Int64Cache[value] = result
129 }
130
131 return result
132 }
133
134 /**
135 * Returns Int64 representing the given value, provided that it is a finite number. Otherwise, zero is returned.

Callers 2

int64.jsFile · 0.45
test_int64.jsFile · 0.45

Calls 1

fromBitsMethod · 0.45

Tested by

no test coverage detected