|
Posted by Schraalhans Keukenmeester on 04/29/07 17:56
On Sun, 29 Apr 2007 09:36:38 -0700, brainflakes.org wrote:
> Hi guys,
>
> I need to manipulate binary data (8 bit) stored in a 2 dimensional
> array.
>
> I've tried various methods (arrays, using a string filled with chr(0),
> using gd lib) and so far the fastest way I've found is to actually
> create an 8-bit image in GD and use imagecolorat and imagesetpixel to
> read and write the data.
>
> Are there actually any proper binary extensions or is using gd lib the
> way to go (as I guess it's just dealing with binary data as a 2d array
> anyway)
>
> Andrew
What kind if wizardry are you trying to achieve? Maybe a bit of your code
and an explanation of what you are after makes helping easier.
You are aware of the bitwise operators: (are you?)
$a & $b And Bits that are set in both $a and $b are set.
$a | $b Or Bits that are set in either $a or $b are set.
$a ^ $b Xor Bits that are set in $a or $b but not both are set.
~ $a Not Bits that are set in $a are not set, and vice versa.
$a << $b Shift left Shift the bits of $a $b steps to the left
(each step means "multiply by two")
$a >> $b Shift right Shift the bits of $a $b steps to the right
(each step means "divide by two")
Sh.
Navigation:
[Reply to this message]
|