[svn:parrot] r38000 - trunk/src/pmc
cotto at svn.parrot.org
cotto at svn.parrot.org
Fri Apr 10 02:04:27 UTC 2009
Author: cotto
Date: Fri Apr 10 02:04:26 2009
New Revision: 38000
URL: https://trac.parrot.org/parrot/changeset/38000
Log:
[PMC] change Integer's i_add to a VTABLE function where possible
Modified:
trunk/src/pmc/integer.pmc
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Fri Apr 10 00:02:46 2009 (r37999)
+++ trunk/src/pmc/integer.pmc Fri Apr 10 02:04:26 2009 (r38000)
@@ -425,26 +425,32 @@
*/
- MULTI void i_add(Integer value) {
- STATICSELF.i_add_int(VTABLE_get_integer(INTERP, value));
- }
+ VTABLE void i_add(PMC *value) {
+ const INTVAL type = value->vtable->base_type;
+ switch (type) {
+ case enum_class_Integer:
+ STATICSELF.i_add_int(VTABLE_get_integer(INTERP, value));
+ break;
- MULTI void i_add(Complex value) {
- const INTVAL a = SELF.get_integer();
+ case enum_class_Complex:
+ pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
+ VTABLE_set_number_native(INTERP, SELF,
+ SELF.get_integer() + VTABLE_get_number(INTERP, value));
+ break;
- pmc_reuse(INTERP, SELF, enum_class_Complex, 0);
- VTABLE_set_number_native(INTERP, SELF,
- SELF.get_integer() + VTABLE_get_number(INTERP, value));
+ default:
+ VTABLE_set_number_native(INTERP, SELF,
+ SELF.get_integer() + VTABLE_get_number(INTERP, value));
+ break;
+ }
}
-
MULTI void i_add(DEFAULT value) {
VTABLE_set_number_native(INTERP, SELF,
SELF.get_integer() + VTABLE_get_number(INTERP, value));
}
-
VTABLE void i_add_int(INTVAL b) {
const INTVAL a = SELF.get_integer();
const INTVAL c = a + b;
More information about the parrot-commits
mailing list