Skip to content

Commit

Permalink
fix: wrong new_pages calculation in StableMultiLog (#4370)
Browse files Browse the repository at this point in the history
Fix the wrong calculation on the new pages needed to grow stable memory in the StableMultiLog example used in our documentation.
  • Loading branch information
ninegua authored Jan 24, 2024
1 parent 69729b1 commit e0a75d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/md/examples/StableMultiLog.mo
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ actor StableLog {
func regionEnsureSizeBytes(r : Region, new_byte_count : Nat64) {
let pages = Region.size(r);
if (new_byte_count > pages << 16) {
let new_pages = pages - ((new_byte_count + ((1 << 16) - 1)) / (1 << 16));
let new_pages = ((new_byte_count + ((1 << 16) - 1)) / (1 << 16)) - pages;
assert Region.grow(r, new_pages) == pages
}
};
Expand Down

0 comments on commit e0a75d5

Please sign in to comment.