Function t8_A_times_B_over_C_intA

Function Documentation

static inline t8_gloidx_t t8_A_times_B_over_C_intA(const int A, const t8_gloidx_t B, const t8_gloidx_t C)

Computes (A*B)/C for large integers, where A is an int and B, C are t8_gloidx_t. This function is useful when A*B might not fit in a 64-bit integer. It uses the formula: (A*B)/C = floor(floor(A/C)*B + ((AC)/C)*B)

Parameters:
  • A[in] The first integer.

  • B[in] The second large integer.

  • C[in] The divisor, a large integer.

Returns:

The result of (A*B)/C as a t8_gloidx_t.