Skip to content

Commit

Permalink
Use 31-bit digits instead of 63-bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxitg committed Dec 4, 2020
1 parent 5d5ab41 commit c9cb812
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Kernel/CombinatorLeftmostOutermostLeafCounts.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
decodedLength = {spec}[[1]];
digitCounts = {spec}[[2 ;; decodedLength + 1]];
digitLists = TakeList[{spec}[[decodedLength + 2 ;; ]], digitCounts];
Fold[2^63 # + #2 &, 0, #] & /@ digitLists
Fold[2^31 # + #2 &, 0, #] & /@ digitLists
]

SKCombinatorLeftmostOutermostLeafCounts[initExpr_, eventsCount_] /; $libraryFile =!= $Failed :=
Expand Down
4 changes: 2 additions & 2 deletions libCombinatorEvolve/CombinatorEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ MTensor putMPZVector(const std::vector<mpz_class>& data, WolframLibraryData libD
std::vector<uint64_t> digits;
mpz_class remainingNumber = number;
mpz_class digitSize;
mpz_pow_ui(digitSize.get_mpz_t(), mpz_class(2).get_mpz_t(), 63);
mpz_pow_ui(digitSize.get_mpz_t(), mpz_class(2).get_mpz_t(), 31);
while (remainingNumber > 0) {
mpz_class thisDigit = remainingNumber & (digitSize - 1);
digits.push_back(thisDigit.get_ui());
remainingNumber >>= 63;
remainingNumber >>= 31;
}
lengths.push_back(digits.size());
allDigits.insert(allDigits.end(), digits.rbegin(), digits.rend());
Expand Down

0 comments on commit c9cb812

Please sign in to comment.