Qt take one of the binary number

QString Global::GetBit( int x, int y)
{
    return  QString::number((x) >> (y-1)&1);
}

use:

  Such as: 55 ----> 00110111 (High -> Low)

    55 taken third, GetBit (55, 3); Results: 1

    55 taken fourth, GetBit (55, 4); Results: 0

Guess you like

Origin www.cnblogs.com/jiangson/p/11310002.html