0

I have to do 5 byte unsigned Int square. For example, I made a 5 byte random unsigned interger, and then want to know square these random unsigned interger at assembly lang. In x86-32 and MASM assembler, They does not support over the 32bit. So I meet trouble that square of it. We can use Irvine32 library, and below pic is the Irvine32 library list. Irvine32 library Please help me how to square these random 5byte unsigned interger.

Maybe, I think 5byte divide into 4 byte and 1byte to square it. But I don't know how to do it.

HJH
  • 11
  • 2
    Same as how compilers handle `uint64_t` when compiling for 32-bit. With 1 extra byte instead of 4, you can just zero-extend it to 32 to get a full 64-bit integer and then apply the usual methods, like `mul r32` and two `imul reg, reg` for the low x high cross products. As in [How can I multiply two 64-bit numbers using x86 assembly language?](https://stackoverflow.com/a/23588103). There are multiple other Q&As about the algorithm. – Peter Cordes Jun 05 '23 at 05:17

0 Answers0