首页 > 代码库 > GetWordBit & MakeDWORD

GetWordBit & MakeDWORD

static WORD GetWordBit(WORD word, int bit)
{
    WORD w = 0;
    WORD and = 1;

    if((bit<0)||(bit>15))
        return 0;

    w = word;
    and = and << bit;
    w = (w & and);
    w = w >> bit;

    return w;
}

static DWORD MakeDWORD(WORD wLowWord, WORD wHighWord)
{
    DWORD dw;

    dw = wHighWord;
    dw = (dw << 16);
    dw += wLowWord;

    return dw;
}

 

GetWordBit & MakeDWORD