U8_MAX = 0xFFFFFFFFFFFFFFFF U16_MAX = U8_MAX << 64 | U8_MAX U32_MAX = U16_MAX << 128 | U16_MAX def dothex(num): strhex = hex(num)[2:] dothex = strhex[-16:] strhex = strhex[:-16] while len(strhex) > 0: dothex = strhex[-16:] + '.' + dothex strhex = strhex[:-16] return '0x' + dothex print('mul_u16', dothex((U16_MAX * U8_MAX >> 128) % (U16_MAX + 1)), dothex(U16_MAX * U8_MAX % (U16_MAX + 1))) print('mul_u16', dothex((U16_MAX * U16_MAX >> 128) % (U16_MAX + 1)), dothex(U16_MAX * U16_MAX % (U16_MAX + 1))) print('mul_lo_u32', dothex(U32_MAX * U16_MAX % (U32_MAX + 1))) print('div_lo_u32', dothex(U32_MAX // U8_MAX), dothex(U32_MAX - U32_MAX // U8_MAX))