using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IOB_UT_NEXT
{
    public class BitUtils
    {
        /// <summary>
        /// Test se il bit sia attivo
        /// </summary>
        /// <param name="val2check">valkore da verificare</param>
        /// <param name="bitNum">bit da verificare (0 based, 00..31)</param>
        /// <returns></returns>
        public static bool isActive(int val2check, int bitNum)
        {
            bool answ = false;
            // testa i-esimo bit (max 32 bit...)
            if (bitNum <= 31)
            {
                answ = ((val2check & (1 << bitNum)) != 0);
            }
            return answ;
        }
    }
}
