You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#pragma once
|
|
|
|
|
//λ<><CEBB><EFBFBD>㺯<EFBFBD><E3BAAF>
|
|
|
|
|
|
|
|
|
|
//PortVal <20><>PortIdx λ<><CEBB><EFBFBD><EFBFBD>Ϊ1
|
|
|
|
|
inline long SetBitOn(long Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
Val= Val |(1<<Idx);
|
|
|
|
|
return Val;
|
|
|
|
|
}
|
|
|
|
|
inline void SetIntBitOn(int &Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
Val= Val |(1<<Idx);
|
|
|
|
|
}
|
|
|
|
|
inline void SetIntBitOff(int &Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
Val = (Val)&(~(1<<Idx));
|
|
|
|
|
}
|
|
|
|
|
inline void SetIntBitState(int &Val,int Idx,bool bOn)
|
|
|
|
|
{
|
|
|
|
|
if(bOn)
|
|
|
|
|
SetIntBitOn(Val,Idx);
|
|
|
|
|
else
|
|
|
|
|
SetIntBitOff(Val,Idx);
|
|
|
|
|
}
|
|
|
|
|
//PortVal <20><>PortIdx λ<><CEBB><EFBFBD><EFBFBD>Ϊ0
|
|
|
|
|
inline BYTE SetBitOff(BYTE Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
Val = (Val)&(~(1<<Idx));
|
|
|
|
|
return Val;
|
|
|
|
|
}
|
|
|
|
|
//<2F>ж<EFBFBD>ijλ<C4B3>Ƿ<EFBFBD>Ϊ1,PortIdx <20><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>
|
|
|
|
|
inline BOOL IsBitOn(BYTE Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
if((Val>>Idx)&1)
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
inline BOOL IsBitOn(int Val,int Idx)
|
|
|
|
|
{
|
|
|
|
|
if((Val>>Idx)&1)
|
|
|
|
|
return TRUE;
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
inline long SetBitByBool(BYTE Val,int Idx,bool b)
|
|
|
|
|
{
|
|
|
|
|
if(b)
|
|
|
|
|
return SetBitOn(Val,Idx);
|
|
|
|
|
return SetBitOff(Val,Idx);
|
|
|
|
|
}
|