// parity here means total number of set bits in a number
typedef int bool ;
int parity ( unsigned int num )
{
bool parity = 0 ; // 0 means even parity and 1 meand odd parity
while ( num )
{
parity = !parity ;
num &= n-1 ;
}
return parity;
}
i haave seen a million faces
but still my heart embraces
No comments:
Post a Comment