cvsuser 03/10/23 01:08:19
Modified: classes perlint.pmc
t/pmc perlint.t
Log:
use standard implementation for logical PerlInt vtables
Revision Changes Path
1.50 +1 -29 parrot/classes/perlint.pmc
Index: perlint.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlint.pmc,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -w -r1.49 -r1.50
--- perlint.pmc 22 Oct 2003 18:43:22 -0000 1.49
+++ perlint.pmc 23 Oct 2003 08:08:15 -0000 1.50
@@ -1,7 +1,7 @@
/* perlint.pmc
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: perlint.pmc,v 1.49 2003/10/22 18:43:22 leo Exp $
+ * $Id: perlint.pmc,v 1.50 2003/10/23 08:08:15 leo Exp $
* Overview:
* These are the vtable functions for the PerlInt base class
* Data Structure and Algorithms:
@@ -443,34 +443,6 @@
}
}
- void logical_or (PMC* value, PMC* dest) {
- VTABLE_set_integer_native(INTERP, dest,
- SELF->cache.int_val ? SELF->cache.int_val :
- VTABLE_get_integer(INTERP, value)
- );
- }
-
- void logical_and (PMC* value, PMC* dest) {
- VTABLE_set_integer_native(INTERP, dest,
- !SELF->cache.int_val ? SELF->cache.int_val :
- VTABLE_get_integer(INTERP, value)
- );
- }
-
- void logical_xor (PMC* value, PMC* dest) {
- INTVAL left_truth, right_truth, res;
-
- left_truth = SELF->cache.int_val;
- right_truth = VTABLE_get_integer(INTERP, value);
- if ((left_truth && right_truth) || (!left_truth && !right_truth))
- res = 0;
- else if (left_truth)
- res = left_truth;
- else
- res = right_truth;
-
- VTABLE_set_integer_native(INTERP, dest, res);
- }
void logical_not (PMC* value) {
VTABLE_set_integer_native(INTERP, value,
1.13 +21 -1 parrot/t/pmc/perlint.t
Index: perlint.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/perlint.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- perlint.t 22 Oct 2003 18:43:24 -0000 1.12
+++ perlint.t 23 Oct 2003 08:08:19 -0000 1.13
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 22;
+use Parrot::Test tests => 23;
use Parrot::PMC '%pmc_types';
my $perlint = $pmc_types{'PerlInt'};
my $ok = '"ok 1\n"';
@@ -657,3 +657,23 @@
20
10
OUTPUT
+
+output_is(<<'CODE', <<OUTPUT, "or_p_p_p with Num value");
+ new P0, .PerlNum
+ new P1, .PerlInt
+ new P2, .PerlInt
+ set P0, 10.5
+ set P1, 20
+ or P2, P1, P0
+ print P2
+ print "\n"
+ set P1, 0
+ or P2, P1, P0
+ print P2
+ print "\n"
+ end
+CODE
+20
+10.500000
+OUTPUT
+