V
vib
Hi there,
Below is the code that compares bit by bit of 32-bits word. Two
errors(bits) are allowed. I am not sure if this is the right way to
check for x number of error bits. Advice and suggestion are all
welcome.
/* not compiler tested */
unsigned int BitMask;
unsigned int inWord;
unsigned int pattern;
unsigned int errCnt;
unsigned int temp;
Mask = 0x1;
errCnt = 0;
for ( i= 0; i< 32; i++)
{
temp = (inWord&BitMask ) & (pattern&BitMask ) )
if(!temp)
{
if(++errCnt > 2)
break;
}
BitMask = BitMask << 1;
}
Thanks in advance.
vib
Below is the code that compares bit by bit of 32-bits word. Two
errors(bits) are allowed. I am not sure if this is the right way to
check for x number of error bits. Advice and suggestion are all
welcome.
/* not compiler tested */
unsigned int BitMask;
unsigned int inWord;
unsigned int pattern;
unsigned int errCnt;
unsigned int temp;
Mask = 0x1;
errCnt = 0;
for ( i= 0; i< 32; i++)
{
temp = (inWord&BitMask ) & (pattern&BitMask ) )
if(!temp)
{
if(++errCnt > 2)
break;
}
BitMask = BitMask << 1;
}
Thanks in advance.
vib