====== Request for Comments: 64-bit Integer type ====== * Version: 1.0 * Date: 2010-06-05 * Author: Kalle Sommer Nielsen , Pierrick Charron * Status: Work-in-progress * First Published at: http://wiki.php.net/rfc/64bit-integer-type This RFC is about adding a 64bit integer type to PHP. ===== Introduction ===== Currently PHP's int type is 32bit on x86 systems, and 64bit on x64 systems. Sometimes you will need to handle numbers thats bigger than the 32bit integer limit and have to either use dirty hacks like converting to a float/string or use extensions like BCMath for such operations. This RFC proposes a new type ("int64"), which always is 64bit long no matter the host arch. ===== User land ===== ==== Declarings ==== To remain consistent and not changing the current integer type declarings, a new prefix will be available for declaring 64bit long integers: ==== Type casts ==== Like the integer type, you may also cast to a 64bit integer: The type cast have a "long" name alias too: (integer64) ==== Functions ==== New function(s) should be inserted into the core * is_int64 (Or maybe the is_int function should me modified) ===== Internals ===== ==== Data type ==== The 64bit integer will internally be stored as 'zend_long64', as currently defined in zend_types.h ==== API ==== The API will be identical to the current type handling functions/macros that already exists: * RETURN_LONG64 * IS_LONG64 * convert_to_long64() * etc. ==== Parameter parsing ==== To parse the 64bit integer via the parameter_parsing API, the 'i' modifier will be in place like the 'l' for 'long'. Aswell as the 'I' modifier for limiting out of range values to minimum/maxmimum values of a zend_long64 ===== Patch ===== Currently no patch is available, but it is in the works.