mout
Version:
Modular Utilities
9 lines (8 loc) • 307 B
TypeScript
/**
* "Convert" value into an 32-bit integer.
* Works like `Math.floor` if val > 0 and `Math.ceil` if val < 0.
* IMPORTANT: val will wrap at 2^31 and -2^31.
* Perf tests: http://jsperf.com/vs-vs-parseint-bitwise-operators/7
*/
declare function toInt(val: number): number;
export default toInt;