return pp_ucfirst();
}
+PP(pp_slt)
+{
+ return pp_sle();
+}
+
+PP(pp_sgt)
+{
+ return pp_sle();
+}
+
+PP(pp_sge)
+{
+ return pp_sle();
+}
+
U8 *
Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
{
MEMBER_TO_FPTR(Perl_pp_i_ne),
MEMBER_TO_FPTR(Perl_pp_ncmp),
MEMBER_TO_FPTR(Perl_pp_i_ncmp),
- MEMBER_TO_FPTR(Perl_pp_slt),
- MEMBER_TO_FPTR(Perl_pp_sgt),
+ MEMBER_TO_FPTR(Perl_pp_sle), /* Perl_pp_slt */
+ MEMBER_TO_FPTR(Perl_pp_sle), /* Perl_pp_sgt */
MEMBER_TO_FPTR(Perl_pp_sle),
- MEMBER_TO_FPTR(Perl_pp_sge),
+ MEMBER_TO_FPTR(Perl_pp_sle), /* Perl_pp_sge */
MEMBER_TO_FPTR(Perl_pp_seq),
MEMBER_TO_FPTR(Perl_pp_sne),
MEMBER_TO_FPTR(Perl_pp_scmp),
Perl_pp_and => ['andassign'],
Perl_pp_or => ['orassign'],
Perl_pp_ucfirst => ['lcfirst'],
+ Perl_pp_sle => [qw(slt sgt sge)],
);
while (my ($func, $names) = splice @raw_alias, 0, 2) {
}
}
-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;
}
}