Re: [PHP] building binary data structures

2001-02-15 Thread Richard Lynch

 Having written loads of stuff in PHP, I find myself having for the first
 time to generate binary data in memory - I actually need to build a native
 file for a drawing program in memory. The data consists mainly of lists of
 32bit little endian integers - some signed and some unsigned. I've started
 the work, and am building the data up in a string variable. I know however
 that I am about to get bitten by numeric overflows.

 For example if I have a function create_thingy($param1,$param2) where
param1
 is an unsigned 32 bit int, and the top bit is set, then I suspect that php
 will probably represent the number as floating point, and I'll probably
lose
 some precision.

 Has anybody been here before and found a good mode of working in the
 unsigned 32bit arena?

BCMATH would work...
If you're already messing around with using strings, you might as well use
BCMATH.
You now know as much about BCMATH as I do...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] building binary data structures

2001-02-11 Thread Phil Driscoll

Having written loads of stuff in PHP, I find myself having for the first
time to generate binary data in memory - I actually need to build a native
file for a drawing program in memory. The data consists mainly of lists of
32bit little endian integers - some signed and some unsigned. I've started
the work, and am building the data up in a string variable. I know however
that I am about to get bitten by numeric overflows.

For example if I have a function create_thingy($param1,$param2) where param1
is an unsigned 32 bit int, and the top bit is set, then I suspect that php
will probably represent the number as floating point, and I'll probably lose
some precision.

Has anybody been here before and found a good mode of working in the
unsigned 32bit arena?

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]