This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pp_divide: use modulo instead of multiplication
authorTomasz Konojacki <me@xenu.pl>
Mon, 15 Oct 2018 03:24:27 +0000 (05:24 +0200)
committerTony Cook <tony@develop-help.com>
Fri, 2 Nov 2018 03:53:42 +0000 (14:53 +1100)
commitf196658042490a6287fc178f0bc20fd5558ac54b
tree9d76a58641f2aa0058af1375101d22fb35e31159
parent191f8909fa4eca1db16a91ada42dd4a065c04890
pp_divide: use modulo instead of multiplication

On most architectures with hardware integer division (like
x86 or aarch64), division instruction returns both the remainder
and the quotient. It means that performing modulo operation
immediately after division using the same operands is 100% free.

Essentially this commit changes "div" and "mul" into a single "div"
instruction, which results in minor speed up.

[perl #133511]
pp.c