New uint native data type?

From: Date: Fri, 25 Jan 2013 21:39:26 +0000
Subject: New uint native data type?
Groups: php.internals 
Request: Send a blank email to internals+get-65194@lists.php.net to get a copy of this message
Hi all, I'm currently writing a php-program to process certain special binary files, which include 32-bit offsets which I need to read and manipulate. The problem is that PHPs int type is only 31-bit because they have sign information. Sure, I could use the GMP/bcmath stuff, but that isn't really an option because of performance and the fact that I'd have to use bc* functions everywhere, and the code is already complex enough. Because I need to do maths and, later on, file accesses at positions > 2GB, with them and not just print, sprintf("%u",$val) is not sufficient, too. Switching to 64-bit doesn't help in my case, as the program interfaces with external windows-only dependencies and the PHP x64 build doesn't do 64-bit ints at the moment. Would it be possible to extend the PHP engine and add a "uint" native type which allows handling of full 32-bit values and if yes, is there any documentation about the parts of the engine I need to modify? The PHP internals manual doesn't have much content and the Zend / main directories in the source code lack useful information, too. Thanks, Marco

« previous php.internals (#65194) next »