Thread: Querying and setting a particular bit in a varying bit value

Querying and setting a particular bit in a varying bit value

From
S P Arif Sahari Wibowo
Date:
Hi!

What will be the most efficient way to query the value of a certain bit in
a varying bit field, and what will be the most efficient way to replace
(set/unset) a certain bit in a varying bit field (dynamic length)?

Unfortunately the AND and OR operation require the bits have same length.

Right now the easiest way seems to use substring function, but this
function will use a lot of expensive bit shifting. Is there any better
way?

Thank you.

--
                                   S P Arif Sahari Wibowo
  _____  _____  _____  _____
 /____  /____/ /____/ /____          arifsaha@yahoo.com
_____/ /      /    / _____/       http://www.arifsaha.com/