summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2001-11-24 16:24:33 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-24 15:26:37 +0000
commit30de85b6294027ce5dd68a336e7f75fe8fb14941 (patch)
tree7a765471c704c1da36c2030e220cbf526bd01eb7 /pp.c
parentb51d9c98646cc7c622f6896e9d6e994eeebd7ba5 (diff)
downloadperl-30de85b6294027ce5dd68a336e7f75fe8fb14941.tar.gz
Re: Smoke 13191 /pro/3gl/CPAN/perl-current
Message-ID: <20011124162433.Q37621@plum.flirble.org> cmp fixes. p4raw-id: //depot/perl@13235
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/pp.c b/pp.c
index e4354eabf3..15949f9979 100644
--- a/pp.c
+++ b/pp.c
@@ -1543,6 +1543,13 @@ PP(pp_lt)
}
}
#endif
+#ifndef NV_PRESERVES_UV
+ else if (SvROK(TOPs) && SvROK(TOPm1s)) {
+ SP--;
+ SETs(boolSV(SvRV(TOPs) < SvRV(TOPp1s)));
+ RETURN;
+ }
+#endif
{
dPOPnv;
SETs(boolSV(TOPn < value));
@@ -1611,6 +1618,13 @@ PP(pp_gt)
}
}
#endif
+#ifndef NV_PRESERVES_UV
+ else if (SvROK(TOPs) && SvROK(TOPm1s)) {
+ SP--;
+ SETs(boolSV(SvRV(TOPs) > SvRV(TOPp1s)));
+ RETURN;
+ }
+#endif
{
dPOPnv;
SETs(boolSV(TOPn > value));
@@ -1679,6 +1693,13 @@ PP(pp_le)
}
}
#endif
+#ifndef NV_PRESERVES_UV
+ else if (SvROK(TOPs) && SvROK(TOPm1s)) {
+ SP--;
+ SETs(boolSV(SvRV(TOPs) <= SvRV(TOPp1s)));
+ RETURN;
+ }
+#endif
{
dPOPnv;
SETs(boolSV(TOPn <= value));
@@ -1747,6 +1768,13 @@ PP(pp_ge)
}
}
#endif
+#ifndef NV_PRESERVES_UV
+ else if (SvROK(TOPs) && SvROK(TOPm1s)) {
+ SP--;
+ SETs(boolSV(SvRV(TOPs) >= SvRV(TOPp1s)));
+ RETURN;
+ }
+#endif
{
dPOPnv;
SETs(boolSV(TOPn >= value));
@@ -1772,19 +1800,16 @@ PP(pp_ne)
bool auvok = SvUOK(TOPm1s);
bool buvok = SvUOK(TOPs);
- if (!auvok && !buvok) { /* ## IV <=> IV ## */
- IV aiv = SvIVX(TOPm1s);
- IV biv = SvIVX(TOPs);
-
- SP--;
- SETs(boolSV(aiv != biv));
- RETURN;
- }
- if (auvok && buvok) { /* ## UV != UV ## */
- UV auv = SvUVX(TOPm1s);
- UV buv = SvUVX(TOPs);
+ if (auvok == buvok) { /* ## IV == IV or UV == UV ## */
+ /* Casting IV to UV before comparison isn't going to matter
+ on 2s complement. On 1s complement or sign&magnitude
+ (if we have any of them) it could make negative zero
+ differ from normal zero. As I understand it. (Need to
+ check - is negative zero implementation defined behaviour
+ anyway?). NWC */
+ UV buv = SvUVX(POPs);
+ UV auv = SvUVX(TOPs);
- SP--;
SETs(boolSV(auv != buv));
RETURN;
}