Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      ckd_mul

      From cppreference.com
      <cpp‎ |numeric
       
       
       
      Defined in header<stdckdint.h>
      template<class type1,class type2,class type3>
      bool ckd_mul( type1* result, type2 a, type3 b);
      (since C++26)

      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

      [edit]Parameters

      a, b - integer values
      result - address of where result should be stored

      [edit]Return value

      false if the value assigned to*result correctly represents the mathematical result of the multiplication,true otherwise.

      [edit]Note

      The function templateckd_mul has the same semantics as the correspondingtype-generic macro with the same name specified inC23.

      Each of the typestype1,type2, andtype3 is a cv-unqualified signed or unsigned integer 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.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]References

      • C++26 standard (ISO/IEC 14882:2026):
      • 29.11.2 Checked integer operations

      [edit]See also

      (C++26)
      checked addition operation on two integers
      (function template)[edit]
      (C++26)
      checked subtraction operation on two integers
      (function template)[edit]
      C documentation forckd_mul
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/numeric/ckd_mul&oldid=181981"

      [8]ページ先頭

      ©2009-2025 Movatter.jp