[b][red]This message was edited by Gregry2 at 2006-9-30 11:46:52[/red][/b][hr]
These are example code clips, different code, but its supposed to do the same thing. The value 'bit' has to be the "index" of a bit in a byte, thus less that CHAR_BIT defined in limits.h. And the value 'byte', well, it follows suit.
The below makes it more quicker when its oldbit already is in [0,CHAR_BIT]
Which is more efficient?
I'd prefer the first one. Although the second one makes saves the division (which is a costly operation compared to an extra jump) for one case, still, if either case is of no higher probability of the other, then it looks messy to make way for one case above the other. However, it would make more sense if the normal case is for oldbit to be lesser than CHAR_BIT...
Thanx for answering as always
EDIT: changed code errors...