UNPKG

@technobuddha/library

Version:
15 lines 789 B
/** * Converts a number to a 32-bit signed integer. * * This function effectively truncates the decimal part of the number * and ensures the result fits within the 32-bit signed integer range. * @param x - The number to convert. * @returns The 32-bit signed integer representation of the input. * @group Binary * @category Arithmetic */ export function int32(x) { // eslint-disable-next-line unicorn/prefer-math-trunc, no-bitwise return x | 0; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50LTMyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2ludC0zMi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7O0dBU0c7QUFDSCxNQUFNLFVBQVUsS0FBSyxDQUFDLENBQVM7SUFDN0IsaUVBQWlFO0lBQ2pFLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNmLENBQUMifQ==