Defined in header <stdckdint.h> | ||
#define ckd_mul( result, a, b ) /* implementation-defined */ // exposed interface: | (since C23) | |
Computes the multiplicationx × y and stores the result into*result. The multiplication is performed as if both operands were represented in a signed integer type with infinite range, and the result was then converted from this integer type totype1. If the value assigned to*result correctly represents the mathematical result of the operation, it returnsfalse. Otherwise, it returnstrue. In this case, the value assigned to*result is the mathematical result of the operation wrapped around to the width of*result.
Contents |
| a, b | - | integer values |
| result | - | address of where result should be stored |
false if the value assigned to*result correctly represents the mathematical result of the multiplication,true otherwise.
Bothtype2 andtype3 shall be any integer type other than “plain”char,bool, abit-precise integer type, or anenumerated type, and they can be the same.*result shall be a modifiable lvalue of any integer type other than “plain”char,bool, a bit-precise integer type, or an enumerated type.
It is recommended to produce a diagnostic message iftype2 ortype3 are not suitable integer types, or if*result is not a modifiable lvalue of a suitable integer type.
| This section is incomplete Reason: no example |
(C23) | checked addition operation on two integers (type-generic function macro)[edit] |
(C23) | checked subtraction operation on two integers (type-generic function macro)[edit] |
C++ documentation forckd_mul | |