diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-02-07 18:01:26 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-02-07 18:01:26 +0000 |
commit | 3658c1f1e67f531ad4ee20e8c748aec14b993c44 (patch) | |
tree | 32b3f67e0e63185b74168c07ec6bac15029030db /pp.c | |
parent | d4ac975eac140a6fda54f99664f15120fd97e7be (diff) | |
download | perl-3658c1f1e67f531ad4ee20e8c748aec14b993c44.tar.gz |
Merging pp_bit_or and pp_bit_xor shrinks the object code by about .7K.
The overloading tests are not free.
p4raw-id: //depot/perl@27126
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 44 |
1 files changed, 13 insertions, 31 deletions
@@ -2205,50 +2205,32 @@ PP(pp_bit_and) } } -PP(pp_bit_xor) -{ - dVAR; dSP; dATARGET; tryAMAGICbin(bxor,opASSIGN); - { - dPOPTOPssrl; - SvGETMAGIC(left); - SvGETMAGIC(right); - if (SvNIOKp(left) || SvNIOKp(right)) { - if (PL_op->op_private & HINT_INTEGER) { - const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) ^ SvIV_nomg(right); - SETi(i); - } - else { - const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) ^ SvUV_nomg(right); - SETu(u); - } - } - else { - do_vop(PL_op->op_type, TARG, left, right); - SETTARG; - } - RETURN; - } -} - PP(pp_bit_or) { - dVAR; dSP; dATARGET; tryAMAGICbin(bor,opASSIGN); + dVAR; dSP; dATARGET; + const int op_type = PL_op->op_type; + + tryAMAGICbin_var((op_type == OP_BIT_OR ? bor_amg : bxor_amg), opASSIGN); { dPOPTOPssrl; SvGETMAGIC(left); SvGETMAGIC(right); if (SvNIOKp(left) || SvNIOKp(right)) { if (PL_op->op_private & HINT_INTEGER) { - const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) | SvIV_nomg(right); - SETi(i); + const IV l = (USE_LEFT(left) ? SvIV_nomg(left) : 0); + const IV r = SvIV_nomg(right); + const IV result = op_type == OP_BIT_OR ? (l | r) : (l ^ r); + SETi(result); } else { - const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) | SvUV_nomg(right); - SETu(u); + const UV l = (USE_LEFT(left) ? SvUV_nomg(left) : 0); + const UV r = SvUV_nomg(right); + const UV result = op_type == OP_BIT_OR ? (l | r) : (l ^ r); + SETu(result); } } else { - do_vop(PL_op->op_type, TARG, left, right); + do_vop(op_type, TARG, left, right); SETTARG; } RETURN; |