Re: A89: Filling a Byte in C
[Prev][Next][Index][Thread]
Re: A89: Filling a Byte in C
Hi,
| >
| > Well, it becomes 0 if you're masking the value to 8 bits...
| >
|
| Since the function GetByteMask() return a byte, that is what will
happen...
Great! That's exactly what I need. Then I can think of the following way:
Take the number 2^(End-Start+1) (by shifting)
Subtract 1 to fill the bits from 0 to End-Start with ones
Shift the whole thing Start bits
Or, I could take 2^(End+1), subtract one, and then subtract 2^Start-1. This
seems to be exactly what mheckenbach (whoever hides behind that name) wrote,
because the -1s would subtract themselves out. I'll see if it works.
Thanks everybody and have a nice day,
Sebastian
References: