Re: [PHP] Re: Help with some clever bit operations

2006-07-21 Thread Paul Novitski
Niels schrieb: The problem: A function tries to update an existing value, but is only allowed to write certain bits. There are 3 variables: A: the existing value, eg. 10110101 B: what the function wants to write, eg. 01011100 C: which bits the function is allowed to write, eg. With

[PHP] Re: Help with some clever bit operations

2006-06-13 Thread Barry
Niels schrieb: Hi, I have a problem I can solve with some loops and if-thens, but I'm sure it can be done with bit operations -- that would be prettier. I've tried to work it out on paper, but I keep missing the final solution. Maybe I'm missing something obvious... The problem: A function