S
shafique
Hello,
Can anybody have idea as how to find it there exist consective one's in
a word/dword using bitwise operatiors in C language.
Obviously this can be done by shifting and looping one by one; but
there must be some faster way of doing it.
The thing I want is to define some masks and macros and find if there
are consective ones on a word/dword. e.g. 0000b has no consective
ones.... 00011000b has two consective ones, 0001101... has no
consective ones 000001000 has one consective one! So the requiement is
to find out if there exists any 0 sandwitched between two ones.
Best Regards,
Shafique
Can anybody have idea as how to find it there exist consective one's in
a word/dword using bitwise operatiors in C language.
Obviously this can be done by shifting and looping one by one; but
there must be some faster way of doing it.
The thing I want is to define some masks and macros and find if there
are consective ones on a word/dword. e.g. 0000b has no consective
ones.... 00011000b has two consective ones, 0001101... has no
consective ones 000001000 has one consective one! So the requiement is
to find out if there exists any 0 sandwitched between two ones.
Best Regards,
Shafique