Hi Andrea,
Why don't you use the ability of operator overloading? (it's in the engine
since 5.6).
BIGINT don't have to be completely transparent. If user would like to work
with BIGINT, let them crate PHP objects explicitly and then use operator
overloading. e.g.
<?php
function print_powers_of_two($bits) {
$bit = BIGINT(1);
$last = BIGINT(2) ** $bits;
while ($bit < $last) {
$bit *= 2;
echo "$bit\n";
}
}
print_powers_of_two(256);
?>
Your solution would allows writing the same without BIGINT, but not for
free.
I expect, it'll make some slowdown for all PHP scripts, independently, if
they use BIGINT or not.
I'll try to take a deeper look into the patch later...
Could you provide some benchmark results, comparing your patch with master?
Thanks. Dmitry.
On Sat, Oct 11, 2014 at 1:33 AM, Andrea Faulds <[email protected]> wrote:
> Good evening,
>
> Since I don’t want this to languish as a ‘Draft’ forever, despite the
> patch being incomplete, I am finally putting the Big Integer Support RFC
> “Under Discussion”.
>
> The RFC can be found here: https://wiki.php.net/rfc/bigint
>
> The patch is, as I mentioned, incomplete. Additionally, there are quite a
> few matters left to be decided (see Open Questions). However, I think I
> should put this formally under discussion now.
>
> Any help with the patch (largely just updating extensions and the
> mountains of tests these changes break, though later I will need to deal
> with opcache) would be appreciated.
>
> Thanks!
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>