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;
        }
    }
}
