Skip to content

Commit

Permalink
Fix a bug on 32-bit platforms that caused Position::max_altitude to…
Browse files Browse the repository at this point in the history
… return

the wrong value, as a result of assuming that `usize` is 64 bits.
fixes #56

Signed-off-by: Daira Hopwood <[email protected]>
  • Loading branch information
daira committed Feb 23, 2023
1 parent 070a758 commit 86f0903
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to Rust's notion of

## [Unreleased]

### Fixed

- A bug affecting 32-bit platforms caused `Position::max_altitude` to return the wrong
value. This typically manifested as failures to add commitments to the tree.

## [0.3.0] - 2022-05-10

### Added
Expand Down
8 changes: 8 additions & 0 deletions proptest-regressions/lib.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 713580b935d97377d97711c7f126ad2ef82c961bc4b64b538c551d1b2e8b1cdb # shrinks to ops = [Append("a"), Append("a"), Append("a")]
cc db0c5a37f69e8824f0680d595aaf803e15b207d5571d07db464d8178037d8798 # shrinks to ops = [Append(SipHashable(0)), Append(SipHashable(0)), Authpath(Position(0), 0)]
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Position {
Altitude(if self.0 == 0 {
0
} else {
63 - self.0.leading_zeros() as u8
(usize::BITS - 1 - self.0.leading_zeros()) as u8
})
}

Expand Down

0 comments on commit 86f0903

Please sign in to comment.