computing 64 bit unsigned integer multiplication and subtraction using 32 bit integers

545 Views Asked by At

I have a project to compute 64 bit unsigned integer addition, multiplication and subtraction using only 32 bit signed/unsigned integers in c. The 64 bit unsigned integer is newly defined like this :

typedef struct {
unsigned integer hi;
unsigned integer lo;
} Integer64;

so 64 bit integer is just a struct that stores the upper 32 bit in high and the lower 32 bit in low.

Now I get these two Integer64 and I have to produce the multiplication and subtraction in Integer64 type as well. In multiplication and subtraction function, I am only allowed to use Integer64 type, unsigned int type, and only integer arithmetic and logical operations.

I solved how to write addition function, but I have no clue how to do multiplication and subtraction. Can you guys help?

0

There are 0 best solutions below