Re: [PHP] Re: Binary mah

2004-06-11 Thread Knightking
On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin  
[EMAIL PROTECTED] wrote:

Mark wrote:
[snip]
I'm not sure what's wrong with the code you have, but for the 4-digit  
one you have:

$packed = 4-bit var with ABCD encoded in it
$a = $packed  1;
$b = $packed  2;
$c = $packed  4;
$d = $packed  8;
Just as a side tip, I highly recommend using hexadecimal for bitwise  
functions where possible, i.e.:
$a = $packed  0x1;
$b = $packed  0x2;
$c = $packed  0x4;
$d = $packed  0x8;
$e = $packed  0x10;
$f = $packed  0x20;
$g = $packed  0x40;
$h = $packed  0x80;
$i = $packed  0x100;

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Binary mah

2004-06-11 Thread Justin Patrin
Knightking wrote:
On Thu, 10 Jun 2004 20:08:08 -0700, Justin Patrin  
[EMAIL PROTECTED] wrote:

Mark wrote:
[snip]

I'm not sure what's wrong with the code you have, but for the 4-digit  
one you have:

$packed = 4-bit var with ABCD encoded in it
$a = $packed  1;
$b = $packed  2;
$c = $packed  4;
$d = $packed  8;
Just as a side tip, I highly recommend using hexadecimal for bitwise  
functions where possible, i.e.:
$a = $packed  0x1;
$b = $packed  0x2;
$c = $packed  0x4;
$d = $packed  0x8;
$e = $packed  0x10;
$f = $packed  0x20;
$g = $packed  0x40;
$h = $packed  0x80;
$i = $packed  0x100;

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
That's a lot easier to see the progression. Functionally no different 
than using decimal, but easier to type and verify. ;-)

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