Update for version 0.8
This commit is contained in:
parent
28283c60ea
commit
4be829988a
|
@ -32,9 +32,9 @@
|
|||
#define int64 long long
|
||||
#endif
|
||||
|
||||
/* <summary> */
|
||||
/* Multiply two fixed-precision rational numbers. */
|
||||
/* </summary> */
|
||||
/*
|
||||
* Multiply two fixed-precision rational numbers.
|
||||
*/
|
||||
int fix_mul(int a, int b)
|
||||
{
|
||||
return (int) ((int64) a * (int64) b >> 13);
|
||||
|
|
|
@ -27,13 +27,60 @@
|
|||
#ifndef __INT_H
|
||||
#define __INT_H
|
||||
|
||||
/*
|
||||
* Get the minimum of two integers.
|
||||
*
|
||||
* returns a if a < b else b
|
||||
*/
|
||||
int int_min(int a, int b);
|
||||
|
||||
/*
|
||||
* Get the maximum of two integers.
|
||||
*
|
||||
* returns a if a > b else b
|
||||
*/
|
||||
int int_max(int a, int b);
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
* Get absolute value of integer.
|
||||
*/
|
||||
int int_abs(int a);
|
||||
|
||||
/*
|
||||
* Divide an integer and round upwards.
|
||||
*
|
||||
* a divided by b
|
||||
*/
|
||||
int int_ceildiv(int a, int b);
|
||||
|
||||
/*
|
||||
* Divide an integer by a power of 2 and round upwards.
|
||||
*
|
||||
* a divided by 2^b
|
||||
*/
|
||||
int int_ceildivpow2(int a, int b);
|
||||
|
||||
/*
|
||||
* Divide an integer by a power of 2 and round downwards.
|
||||
*
|
||||
* a divided by 2^b
|
||||
*/
|
||||
int int_floordivpow2(int a, int b);
|
||||
|
||||
/*
|
||||
* Get logarithm of an integer and round downwards.
|
||||
*
|
||||
* log2(a)
|
||||
*/
|
||||
int int_floorlog2(int a);
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue