How do I take an input of 2 32 bit unsigned integers, multiply them and get the output as a 64 bit integer in C? Any help is appreciated! Thanks.
#include <stdint.h>
uint64_t mul64(uint32_t x, uint32_t y) {
return (uint64_t)x*(uint64_t)y;
}
Convert the two integers to 64 bit first, then do a normal multiplication and return the value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With