asar coverage - build #129


src/asar/
File: src/asar/libmisc.h
Date: 2024-01-22 09:44:09
Lines:
4/10
40.0%
Functions:
1/3
33.3%
Branches:
4/6
66.7%

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 1384556 inline unsigned bitround(unsigned x)
33 {
34
2/2
✓ Branch 0 taken 692278 times.
✓ Branch 1 taken 692278 times.
1384556 if ((x & (x - 1)) == 0) return x;
35
2/2
✓ Branch 0 taken 2187532 times.
✓ Branch 1 taken 1152176 times.
3339708 while (x & (x - 1)) x &= x - 1;
36 1152176 return x << 1;
37 }
38