export function uint8Add ( a , b ) { return ( a + b ) & 0xff ; } export function uint16Add ( a , b ) { return ( a + b ) & 0xffff ; } export function uint32Add ( a , b ) { return Number ( ( BigInt ( a ) + BigInt ( b ) ) & 0xffffffffn ) ; } export function uint24 ( v ) { return v & 0xffffff ; } /**Return a > b */ export function uint16Gt ( a , b ) { const halfMod = 0x8000 ; return ( a < b && b - a > halfMod ) || ( a > b && a - b < halfMod ) ; } /**Return a >= b */ export function uint16Gte ( a , b ) { return a === b || uint16Gt ( a , b ) ; } /**Return a > b */ export function uint32Gt ( a , b ) { const halfMod = 0x80000000 ; return ( a < b && b - a > halfMod ) || ( a > b && a - b < halfMod ) ; } /**Return a >= b */ export function uint32Gte ( a , b ) { return a === b || uint32Gt ( a , b ) ; } export const int = ( n ) => parseInt ( n as any , 10 ) ;