[svn:parrot] r39361 - branches/pmc_i_ops/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Wed Jun 3 13:34:16 UTC 2009
Author: bacek
Date: Wed Jun 3 13:34:15 2009
New Revision: 39361
URL: https://trac.parrot.org/parrot/changeset/39361
Log:
[pmc] Integer.divide use i_divide
Modified:
branches/pmc_i_ops/src/pmc/integer.pmc
Modified: branches/pmc_i_ops/src/pmc/integer.pmc
==============================================================================
--- branches/pmc_i_ops/src/pmc/integer.pmc Wed Jun 3 13:33:55 2009 (r39360)
+++ branches/pmc_i_ops/src/pmc/integer.pmc Wed Jun 3 13:34:15 2009 (r39361)
@@ -614,32 +614,17 @@
*/
- MULTI PMC *divide(BigInt value, PMC *dest) {
- PMC *temp;
- maybe_throw_overflow_error(INTERP);
- temp = VTABLE_get_bignum(INTERP, SELF);
- return VTABLE_divide(INTERP, temp, value, dest);
- }
-
- MULTI PMC *divide(DEFAULT value, PMC *dest) {
- const FLOATVAL d = VTABLE_get_number(INTERP, value);
-
- if (FLOAT_IS_ZERO(d))
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_DIV_BY_ZERO,
- "float division by zero");
-
- dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
- VTABLE_set_number_native(INTERP, dest, SELF.get_number() / d);
+ MULTI PMC *divide(DEFAULT *value, PMC *dest) {
+ dest = VTABLE_clone(INTERP, SELF);
+ VTABLE_i_divide(INTERP, dest, value);
return dest;
}
-
MULTI void i_divide(BigInt value) {
upgrade_self_to_bignum(INTERP, SELF);
VTABLE_i_divide(INTERP, SELF, value);
}
-
MULTI void i_divide(DEFAULT value) {
const FLOATVAL d = VTABLE_get_number(INTERP, value);
More information about the parrot-commits
mailing list