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
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Text;
namespace Misc
{
public class MyBase
{
public static int NULL_VALUE = 99999998;
public static bool ISVALIDATA(int x)
{
if (x == NULL_VALUE)
return false;
else
return true;
}
public static bool ISVALIDATA(long x)
{
return ISVALIDATA((int)x);
}
public static UInt32 BIT(int b)
{
return (UInt32)(1 << b);
}
public static UInt32 BIT(UInt16 b)
{
return (UInt32)(1 << b);
}
public static void SIGNBIT(ref UInt32 v, int b)
{
v |= (UInt32)(1 << b);
}
public static void SIGNBIT(ref UInt16 v, int b)
{
v |= (UInt16)(1 << b);
}
public static void SIGNBIT(ref byte v, int b)
{
v |= (byte)(1 << b);
}
public static void CLEARBIT(ref UInt32 v, int b)
{
v &= ~(UInt32)(1 << b);
}
public static void CLEARBIT(ref UInt16 v, int b)
{
v &= (UInt16)(~(1 << b));
}
public static void CLEARBIT(ref byte v, int b)
{
v &= (byte)(~(1 << b));
}
public static bool CHECKBIT(UInt32 temps, int b)
{
if ((temps & BIT(b)) != 0)
return true;
else
return false;
}
}
}