Merge rust-bitcoin/rust-bitcoin#1739: Mutate mul_u64 with mutagen

7cdc90565f Mutate mul_u64 with mutagen (Tobin C. Harding)

Pull request description:

  Add the `mutate` attribute to mutate `mul_u64`. Add non-doc comments listing the two false positives. These are identical but we list them twice so when devs grep for `mutagen false pos` the same number of lines for each function is displayed as is displayed by the `mutagen` run. This coding false positives thing is also introduced in PR #1655.

ACKs for top commit:
  apoelstra:
    ACK 7cdc90565f
  sanket1729:
    utACK 7cdc90565f

Tree-SHA512: d066beb2f9ba198f5af36258ba15cfbd2c7c9ce7596f6340ed1fe2f62a2b0b5296eeb2cb4be30146d019671f1858521c29db917936895b5b3fd36bdb0bd07e57
This commit is contained in:
sanket1729 2023-06-14 17:52:55 -07:00
commit de7fe5e4ec
No known key found for this signature in database
GPG Key ID: 648FFB183E0870A2
1 changed files with 3 additions and 1 deletions

View File

@ -415,7 +415,9 @@ impl U256 {
/// ///
/// The multiplication result along with a boolean indicating whether an arithmetic overflow /// The multiplication result along with a boolean indicating whether an arithmetic overflow
/// occurred. If an overflow occurred then the wrapped value is returned. /// occurred. If an overflow occurred then the wrapped value is returned.
// mutagen false positive: binop_bit, replace `|` with `^` // mutagen false pos mul_u64: replace `|` with `^` (XOR is same as OR when combined with <<)
// mutagen false pos mul_u64: replace `|` with `^`
#[cfg_attr(all(test, mutate), mutate)]
fn mul_u64(self, rhs: u64) -> (U256, bool) { fn mul_u64(self, rhs: u64) -> (U256, bool) {
let mut carry: u128 = 0; let mut carry: u128 = 0;
let mut split_le = let mut split_le =