diff options
Diffstat (limited to 'libopenjpeg/int.c')
| -rw-r--r-- | libopenjpeg/int.c | 64 |
1 files changed, 40 insertions, 24 deletions
diff --git a/libopenjpeg/int.c b/libopenjpeg/int.c index 21d7c479..283df097 100644 --- a/libopenjpeg/int.c +++ b/libopenjpeg/int.c @@ -24,25 +24,33 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* <summary> */ -/* Get the minimum of two integers. */ -/* </summary> */ +/* + * Get the minimum of two integers. + * + * returns a if a < b else b + */ int int_min(int a, int b) { return a < b ? a : b; } -/* <summary> */ -/* Get the maximum of two integers. */ -/* </summary> */ +/* + * Get the maximum of two integers. + * + * returns a if a > b else b + */ int int_max(int a, int b) { return a > b ? a : b; } -/* <summary> */ -/* Clamp an integer inside an interval. */ -/* </summary> */ +/* + * Clamp an integer inside an interval. + * + * return a if (min < a < max) + * return max if (a > max) + * return min if (a < min) + */ int int_clamp(int a, int min, int max) { if (a < min) @@ -52,41 +60,49 @@ int int_clamp(int a, int min, int max) return a; } -/* <summary> */ -/* Get absolute value of integer. */ -/* </summary> */ +/* + * Get absolute value of integer. + */ int int_abs(int a) { return a < 0 ? -a : a; } -/* <summary> */ -/* Divide an integer and round upwards. */ -/* </summary> */ +/* + * Divide an integer and round upwards. + * + * a divided by b + */ int int_ceildiv(int a, int b) { return (a + b - 1) / b; } -/* <summary> */ -/* Divide an integer by a power of 2 and round upwards. */ -/* </summary> */ +/* + * Divide an integer by a power of 2 and round upwards. + * + * a divided by 2^b + */ int int_ceildivpow2(int a, int b) { return (a + (1 << b) - 1) >> b; } -/* <summary> */ -/* Divide an integer by a power of 2 and round downwards. */ -/* </summary> */ +/* + * Divide an integer by a power of 2 and round downwards. + * + * a divided by 2^b + */ int int_floordivpow2(int a, int b) { return a >> b; } -/* <summary> */ -/* Get logarithm of an integer and round downwards. */ -/* </summary> */ +/* + * Get logarithm of an integer and round downwards. + * + * log2(a) + */ int int_floorlog2(int a) { int l; |
