C++ bindings for cgul_multiply64
More...
Functions | |
| void | multiply64 (unsigned int x, unsigned int y, unsigned int *high, unsigned int *low) |
This namespace provides the C++ bindings for cgul_multiply64. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_multiply64 into C++-style function calls and exception handling.
|
inline |
This function multiplies two 32-bit unsigned integers x and y to produce a 64-bit unsigned product using only 32-bit arithmetic. The high 32-bits of the 64-bit product will be stored in *high if high is not NULL, and the low 32-bits of the 64-bit product will be stored in *low if low is not NULL.
The following printf() format specification can be used to convert *high and *low into a proper hexadecimal string because it accounts for the significance of the leading zeros in *low:
printf("%#0x%08x", *high, *low);
This function takes about 2.5 times as long to run as native 64-bit multiplication. Thus, it should only be used if your compiler does not support a 64-bit type. To conditionally use this code, include the "cgul_int.h" header and test if CGUL_UINT64 is not defined.
| [in] | x | first 32-bit multiplicand |
| [in] | y | second 32-bit multiplicand |
| [out] | high | high 32-bits of the product of x and y |
| [out] | low | low 32-bits of the product of x and y |
References cgul_multiply64().