Beispiel #1
0
extern "C" Box* intPow(BoxedInt* lhs, Box *rhs) {
    assert(lhs->cls == int_cls);
    if (rhs->cls != int_cls) {
        return NotImplemented;
    }
    BoxedInt *rhs_int = static_cast<BoxedInt*>(rhs);
    return boxInt(pow_i64_i64(lhs->n, rhs_int->n));
}
Beispiel #2
0
extern "C" Box* intPow(BoxedInt* lhs, Box* rhs) {
    assert(lhs->cls == int_cls);
    if (rhs->cls == int_cls) {
        BoxedInt* rhs_int = static_cast<BoxedInt*>(rhs);
        return boxInt(pow_i64_i64(lhs->n, rhs_int->n));
    } else if (rhs->cls == float_cls) {
        BoxedFloat* rhs_float = static_cast<BoxedFloat*>(rhs);
        return boxFloat(pow(lhs->n, rhs_float->d));
    } else {
        return NotImplemented;
    }
}
Beispiel #3
0
extern "C" Box* intPowInt(BoxedInt* lhs, BoxedInt* rhs) {
    assert(isSubclass(lhs->cls, int_cls));
    assert(isSubclass(rhs->cls, int_cls));
    BoxedInt* rhs_int = static_cast<BoxedInt*>(rhs);
    return pow_i64_i64(lhs->n, rhs_int->n);
}
Beispiel #4
0
extern "C" Box* intPowInt(BoxedInt* lhs, BoxedInt* rhs) {
    assert(lhs->cls == int_cls);
    assert(rhs->cls == int_cls);
    BoxedInt* rhs_int = static_cast<BoxedInt*>(rhs);
    return boxInt(pow_i64_i64(lhs->n, rhs_int->n));
}