summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-11-07 21:31:16 +0000
committerNicholas Clark <nick@ccl4.org>2005-11-07 21:31:16 +0000
commitafd9910b0da24dd1fe1207d445456a8c0f2176c5 (patch)
treebf1afd50faf8057693db8f35281eb708e516b5bf /pp.c
parentffb8d87aed2af02cd51b9c989d04b1c37420bea3 (diff)
downloadperl-afd9910b0da24dd1fe1207d445456a8c0f2176c5.tar.gz
Merge pp_slt, pp_sgt and pp_sge into pp_sle. (The most commonly used
of the 4. Not that any are that popular.) p4raw-id: //depot/perl@26039
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c62
1 files changed, 24 insertions, 38 deletions
diff --git a/pp.c b/pp.c
index 8d34510cce..401e1e38c3 100644
--- a/pp.c
+++ b/pp.c
@@ -2091,54 +2091,40 @@ PP(pp_ncmp)
}
}
-PP(pp_slt)
+PP(pp_sle)
{
- dSP; tryAMAGICbinSET_var(slt_amg,0);
- {
- dPOPTOPssrl;
- const int cmp = (IN_LOCALE_RUNTIME
- ? sv_cmp_locale(left, right)
- : sv_cmp(left, right));
- SETs(boolSV(cmp < 0));
- RETURN;
- }
-}
+ dSP;
-PP(pp_sgt)
-{
- dSP; tryAMAGICbinSET_var(sgt_amg,0);
- {
- dPOPTOPssrl;
- const int cmp = (IN_LOCALE_RUNTIME
- ? sv_cmp_locale(left, right)
- : sv_cmp(left, right));
- SETs(boolSV(cmp > 0));
- RETURN;
- }
-}
+ int amg_type = sle_amg;
+ int multiplier = 1;
+ int rhs = 1;
-PP(pp_sle)
-{
- dSP; tryAMAGICbinSET_var(sle_amg,0);
- {
- dPOPTOPssrl;
- const int cmp = (IN_LOCALE_RUNTIME
- ? sv_cmp_locale(left, right)
- : sv_cmp(left, right));
- SETs(boolSV(cmp <= 0));
- RETURN;
+ switch (PL_op->op_type) {
+ case OP_SLT:
+ amg_type = slt_amg;
+ /* cmp < 0 */
+ rhs = 0;
+ break;
+ case OP_SGT:
+ amg_type = sgt_amg;
+ /* cmp > 0 */
+ multiplier = -1;
+ rhs = 0;
+ break;
+ case OP_SGE:
+ amg_type = sge_amg;
+ /* cmp >= 0 */
+ multiplier = -1;
+ break;
}
-}
-PP(pp_sge)
-{
- dSP; tryAMAGICbinSET_var(sge_amg,0);
+ tryAMAGICbinSET_var(amg_type,0);
{
dPOPTOPssrl;
const int cmp = (IN_LOCALE_RUNTIME
? sv_cmp_locale(left, right)
: sv_cmp(left, right));
- SETs(boolSV(cmp >= 0));
+ SETs(boolSV(cmp * multiplier < rhs));
RETURN;
}
}