Skip to content

Commit

Permalink
FIx casts
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Sep 25, 2024
1 parent 7b239cb commit 14bd735
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/num_co.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static void clasp_truncate(Real_sp dividend, Real_sp divisor, Integer_sp& quotie
Real_sp subr;
clasp_truncate(rdividend->numerator() * rdivisor->denominator(), rdivisor->numerator() * rdividend->denominator(), quotient,
subr);
remainder = Rational_O::create(subr.as<Integer_O>(), rdividend->denominator() * rdivisor->denominator());
remainder = Rational_O::create(gc::As<Integer_sp>(subr), rdividend->denominator() * rdivisor->denominator());
return;
}
if (rdividend) {
Expand All @@ -190,7 +190,7 @@ static void clasp_truncate(Real_sp dividend, Real_sp divisor, Integer_sp& quotie
if (rdivisor && dividend.isA<Integer_O>()) {
Real_sp subr;
clasp_truncate(dividend * rdivisor->denominator().as_unsafe<Real_O>(), rdivisor->numerator(), quotient, subr);
remainder = Rational_O::create(subr.as<Integer_O>(), rdivisor->denominator());
remainder = Rational_O::create(gc::As<Integer_sp>(subr), rdivisor->denominator());
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/numbers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ CL_DEFMETHOD Integer_sp LongFloat_O::castToInteger() const {
if (this->_Value < 0) {
double f = -this->_Value;
long long int cf = *(long long int*)&f;
return Integer_O::create(cf)->negate().as<Integer_O>();
return gc::As<Integer_sp>(Integer_O::create(cf)->negate());
}
long long int cf = *(long long int*)&this->_Value;
return Integer_O::create(cf);
Expand Down

0 comments on commit 14bd735

Please sign in to comment.