Line |
Branch |
Exec |
Source |
1 |
|
|
#pragma once |
2 |
|
✗ |
inline int min(int val) |
3 |
|
|
{ |
4 |
|
✗ |
return val; |
5 |
|
|
} |
6 |
|
|
|
7 |
|
✗ |
template<typename... Args> inline int min(int arg1, const Args&... args)//if this is functional programming, I don't want to know more about it. |
8 |
|
|
{ |
9 |
|
✗ |
int i=min(args...); |
10 |
|
✗ |
if (arg1<i) return arg1; |
11 |
|
✗ |
return i; |
12 |
|
|
} |
13 |
|
|
|
14 |
|
|
inline int posmin(int val) |
15 |
|
|
{ |
16 |
|
|
return val; |
17 |
|
|
} |
18 |
|
|
|
19 |
|
|
template<typename... Args> inline int posmin(int arg1, const Args&... args) |
20 |
|
|
{ |
21 |
|
|
int i=posmin(args...); |
22 |
|
|
if (arg1>=0 && arg1<i) return arg1; |
23 |
|
|
return i; |
24 |
|
|
} |
25 |
|
|
|
26 |
|
|
template<int N> struct forceconst { enum { value = N }; }; |
27 |
|
|
#define forceconst(n) (forceconst<n>::value) |
28 |
|
|
|
29 |
|
|
//from nall, license: ISC |
30 |
|
|
//round up to next highest single bit: |
31 |
|
|
//round(15) == 16, round(16) == 16, round(17) == 32 |
32 |
|
1383952 |
inline unsigned bitround(unsigned x) |
33 |
|
|
{ |
34 |
2/2
✓ Branch 0 taken 691976 times.
✓ Branch 1 taken 691976 times.
|
1383952 |
if ((x & (x - 1)) == 0) return x; |
35 |
2/2
✓ Branch 0 taken 2185820 times.
✓ Branch 1 taken 1151870 times.
|
3337690 |
while (x & (x - 1)) x &= x - 1; |
36 |
|
1151870 |
return x << 1; |
37 |
|
|
} |
38 |
|
|
|