-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bitzoic-signed-int-subtraction
- Loading branch information
Showing
55 changed files
with
676 additions
and
500 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
library; | ||
|
||
/// Trait for the Two's Complement of a value. | ||
pub trait TwosComplement { | ||
/// Returns the two's complement of a value. | ||
/// Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type. | ||
pub trait WrappingNeg { | ||
/// Negates a signed number. | ||
/// | ||
/// # Additional Information | ||
/// | ||
/// * The only case where such wrapping can occur is when one negates self::min(). In such a case, this function returns self::min() itself. | ||
/// | ||
/// # Returns | ||
/// | ||
/// * [Self] - The value as two's complement. | ||
fn twos_complement(self) -> Self; | ||
fn wrapping_neg(self) -> Self; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.