Go to the documentation of this file.
32 template<
typename T> uint32_t
ceildiv(T a, T b) {
34 return (uint32_t)((a + (uint64_t) b - 1) / b);
38 return (T)((a + ((uint64_t) 1 << b) - 1) >> b);
48 return (uint32_t)((a + ((uint64_t) 1 << b) - 1) >> b);
65 for (l = 0; a > 1; l++) {
78 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
79 int64_t temp = __emul(a, b);
81 int64_t temp = (int64_t) a * (int64_t) b;
84 assert((temp >> 13) <= (int64_t) 0x7FFFFFFF);
85 assert((temp >> 13) >= (-(int64_t) 0x7FFFFFFF - (int64_t) 1));
88 return (int32_t)(temp >> 13);
T floorlog2(uint32_t a)
Get logarithm of an integer and round downwards.
Definition: grk_intmath.h:63
static uint32_t uint_floordivpow2(uint32_t a, uint32_t b)
Divide an unsigned integer by a power of 2 and round downwards.
Definition: grk_intmath.h:55
T ceildivpow2(T a, uint32_t b)
Definition: grk_intmath.h:37
uint32_t ceildiv(T a, T b)
Divide an integer by another integer and round upwards.
Definition: grk_intmath.h:32
static int32_t int_fix_mul(int32_t a, int32_t b)
Multiply two fixed-point numbers.
Definition: grk_intmath.h:77
Copyright (C) 2016-2021 Grok Image Compression Inc.
Definition: BitIO.cpp:23
static uint32_t uint64_ceildivpow2(uint64_t a, uint32_t b)
Divide a 64-bit integer by a power of 2 and round upwards.
Definition: grk_intmath.h:47