building binary data structures
| From: | Phil Driscoll | Date: | Sun, 11 Feb 2001 17:38:15 +0000 |
| Subject: | building binary data structures | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-39130@lists.php.net to get a copy of this message | ||
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