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

 

posted @ 2017-02-13 12:08  菠萝布丁  阅读(557)  评论(0编辑  收藏  举报