Robert Cummings wrote:
> On Tue, 2006-06-13 at 11:03, Jochem Maas wrote:
>> Robert Cummings wrote:
>>> On Tue, 2006-06-13 at 06:22, Jochem Maas wrote:
My brain needs a crutch when trying doing this kind of thing
(normally I only write hex number literally when dealing with bitwise
s
On Tue, 2006-06-13 at 11:03, Jochem Maas wrote:
> Robert Cummings wrote:
> > On Tue, 2006-06-13 at 06:22, Jochem Maas wrote:
> >> My brain needs a crutch when trying doing this kind of thing
> >> (normally I only write hex number literally when dealing with bitwise
> >> stuff -
> >> the conversion
Robert Cummings wrote:
> On Tue, 2006-06-13 at 06:22, Jochem Maas wrote:
>> My brain needs a crutch when trying doing this kind of thing
>> (normally I only write hex number literally when dealing with bitwise stuff -
>> the conversion stuff still makes my head spin) - this is what this table is
>
On Tue, 2006-06-13 at 06:22, Jochem Maas wrote:
>
> My brain needs a crutch when trying doing this kind of thing
> (normally I only write hex number literally when dealing with bitwise stuff -
> the conversion stuff still makes my head spin) - this is what this table is
> for:
>
> 128 64 32 16 8
- Original Message -
From: "David Tulloh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc:
Sent: Tuesday, June 13, 2006 12:18 PM
Subject: Re: [PHP] Help with some clever bit operations
The example starting values
$existing = 181; # = 10110101
$new = 92; #
On Tuesday 13 June 2006 12:18, David Tulloh wrote:
> The example starting values
> $existing = 181; # = 10110101
> $new = 92; # = 01011100
> $mask = 15; # =
>
> Get the bits that will be changed
> $changing = $new & $mask; # = 12 = 1100
>
> Get the bits that won't be changed
> $stay
On Tuesday 13 June 2006 12:22, Jochem Maas wrote:
> Niels wrote:
>> 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. Mayb
On Tuesday 13 June 2006 12:32, Ford, Mike wrote:
> On 13 June 2006 10:31, Niels wrote:
>
>> 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 m
On 13 June 2006 10:31, Niels wrote:
> 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 obvi
David Tulloh wrote:
> The example starting values
> $existing = 181; # = 10110101
> $new = 92; # = 01011100
> $mask = 15; # =
>
> Get the bits that will be changed
> $changing = $new & $mask; # = 12 = 1100
>
> Get the bits that won't be changed
> $staying = $existing & ~$mask; # = 17
Niels wrote:
> 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 f
The example starting values
$existing = 181; # = 10110101
$new = 92; # = 01011100
$mask = 15; # =
Get the bits that will be changed
$changing = $new & $mask; # = 12 = 1100
Get the bits that won't be changed
$staying = $existing & ~$mask; # = 176 = 1011
Combine them together
$res
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 tries to update an ex
13 matches
Mail list logo