blob: dc71728f5a29d1b2304cd8375e11e5f0e95fde6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Framework.OpenJpeg
{
public static class int_
{
public static int int_min(int a, int b)
{
return a < b ? a : b;
}
public static int int_max(int a, int b)
{
return (a > b) ? a : b;
}
public static int int_clamp(int a, int min, int max)
{
if (a < min)
return min;
if (a > max)
return max;
return a;
}
public static int int_abs(int a)
{
return a < 0 ? -a : a;
}
public static int int_ceildiv(int a, int b)
{
return (a + b - 1) / b;
}
public static int int_ceildivpow2(int a, int b)
{
return (a + (1 << b) - 1) >> b;
}
public static int int_floordivpow2(int a, int b)
{
return a >> b;
}
public static int int_floorlog2(int a)
{
for (int l=0; a > 1; l++)
a >>= 1;
return 1;
}
}
}
|