nitro-renderer/packages/utils/src/Int32.ts
2024-03-19 21:53:17 -04:00

14 lines
225 B
TypeScript

const toUint32 = (x: number) => x >>> 0;
export const ToInt32 = (x: number) =>
{
const uint32 = toUint32(x);
if(uint32 >= Math.pow(2, 31))
{
return uint32 - Math.pow(2, 32);
}
return uint32;
};