Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove src/core/UInt64.pm
This appears to be a leftover from at about 7 years ago.  It created a
subset that was not being used anywhere and a constant that was needed
for Rat/FatRat.  UInt64 (not to be confused with uint64) is not documented
anywhere and not tested.  Moved the constant to src/core/Rat and changed
it into a real constant.

Kudos to Andrew Shitov for spotting this:
  https://perl6.online/2018/01/15/26-native-integers-and-uint-in-perl-6/
  • Loading branch information
lizmat committed Jan 16, 2018
1 parent 64803b0 commit cf15435
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/core/Rat.pm
Expand Up @@ -23,10 +23,12 @@ my class Rat is Cool does Rational[Int, Int] {
}
}

my constant UINT64_UPPER = nqp::pow_I(2, 64, Num, Int);

my class FatRat is Cool does Rational[Int, Int] {
method FatRat(FatRat:D: Real $?) { self }
method Rat (FatRat:D: Real $?) {
$!denominator < $UINT64_UPPER
$!denominator < UINT64_UPPER
?? Rat.new($!numerator, $!denominator)
!! Failure.new("Cannot convert from FatRat to Rat because denominator is too big")
}
Expand All @@ -51,7 +53,7 @@ sub DIVIDE_NUMBERS(Int:D \nu, Int:D \de, \t1, \t2) {
nqp::p6bindattrinvres(nqp::create(FatRat),FatRat,'$!numerator',$numerator),
FatRat,'$!denominator',$denominator),
nqp::if(
$denominator < $UINT64_UPPER,
$denominator < UINT64_UPPER,
nqp::p6bindattrinvres(
nqp::p6bindattrinvres(nqp::create(Rat),Rat,'$!numerator',$numerator),
Rat,'$!denominator',$denominator),
Expand Down
4 changes: 0 additions & 4 deletions src/core/UInt64.pm

This file was deleted.

1 change: 0 additions & 1 deletion tools/build/jvm_core_sources
Expand Up @@ -40,7 +40,6 @@ src/core/Real.pm
src/core/Int.pm
src/core/Bool.pm
src/core/Order.pm
src/core/UInt64.pm
src/core/Num.pm
src/core/Buf.pm
src/core/Encoding/Decoder.pm
Expand Down
1 change: 0 additions & 1 deletion tools/build/moar_core_sources
Expand Up @@ -40,7 +40,6 @@ src/core/Real.pm
src/core/Int.pm
src/core/Bool.pm
src/core/Order.pm
src/core/UInt64.pm
src/core/Num.pm
src/core/Buf.pm
src/core/Uni.pm
Expand Down

0 comments on commit cf15435

Please sign in to comment.