rfc:64bit-integer-type

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rfc:64bit-integer-type [2010/05/06 17:14]
kalle initial revison
rfc:64bit-integer-type [2017/09/22 13:28]
Line 1: Line 1:
-====== Request for Comments: 64-bit Integer type ====== 
-  * Version: 1.0 
-  * Date: 2010-06-05 
-  * Author: Kalle Sommer Nielsen <​kalle@php.net>,​ Pierrick Charron <​adoy@php.net>​ 
-  * 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: 
- 
-<code php> 
-<?php 
-$int64 = L199938937393792738748327842;​ 
- 
-var_dump($int64,​ L209938836626262738748327842);​ 
- 
-/* 
-int64(199938937393792738748327842) 
-int64(209938836626262738748327842) 
-*/ 
-?> 
-</​code>​ 
- 
- 
-==== Type casts ==== 
- 
-Like the integer type, you may also cast to a 64bit integer: 
- 
-<code php> 
-<?php 
- 
-$int64str = '​199938937393792738748327842';​ 
- 
-var_dump((int64) $int64str); 
- 
-/* 
-int64(199938937393792738748327842);​ 
-*/ 
-?> 
-</​code>​ 
- 
-The type cast have a "​long"​ name alias too: (integer64) 
- 
-===== 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. 
rfc/64bit-integer-type.txt · Last modified: 2017/09/22 13:28 (external edit)