Re: Bitwise operators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The second value is the number of spaces to shift, dint realize that.



Thanks for your time Chris.



Angelo



----- Original Message ----- 
From: "Chris Boget" <chris.boget@xxxxxxxx>
To: <cron@xxxxxxxxxx>; <php-general@xxxxxxxxxxxxx>
Sent: Monday, September 26, 2005 2:02 PM
Subject: Re:  Bitwise operators


> >I tested; I don't want to waste peoples time. Rewriting the question:
> > this outputs:
> > c = 32
> > d = 0
> > The question is why?
>
> First row is the bit's number and the second row is the bit's value:
>
> #8  | #7  | #6 | #5 | #4 | #3 | #2 | #1
> ---------------------------------------
> 128 | 64  | 32 | 16 |  8 |  4 |  2 |  1
>
> So your variable $a, which has a value of 4 starts out in the bit position
> of #3 with that bit turned on..  Shift it left 3 (value of $b) spaces and
> you
> end up with bit #6 getting turned on giving you a value of 32, which is
what
> $c is echoing out.
>
> Shifting to the right 3 spaces from the same starting position nets you 0
> with
> all the bits turned off.  At least, I'm pretty sure that's right.
>
> thnx,
> Chris
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux