I256 asr doc (#1860)

* Update I256 documentation to call out diversions from standard numeric types on the right shift operator

* Update changelog

* Address review comment. Link changelog notes to PR

Co-authored-by: Dave Belvedere <dave@protonmail.com>
This commit is contained in:
Dave Belvedere 2022-11-16 05:33:54 +10:00 committed by GitHub
parent 921dfa6b1c
commit 5ae0a848c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -93,7 +93,9 @@
- [#1632](https://github.com/gakonst/ethers-rs/pull/1632) Re-export `H32` from `ethabi`.
- [#1634](https://github.com/gakonst/ethers-rs/pull/1634) Derive missing `Clone`, `Copy` and `Debug` impls in ethers-etherscan.
- Bytes debug format now displays hex literals [#1658](https://github.com/gakonst/ethers-rs/pull/1658)
- [#1451](https://github.com/gakonst/ethers-rs/issues/1451) Add Arithemtic Shift Left operation for I256
- [#1451](https://github.com/gakonst/ethers-rs/issues/1451) Add Arithemtic Shift Left operation for I256
- [#1860](https://github.com/gakonst/ethers-rs/pull/1860)Update I256 type documentation calling out the inconsistency
between its right shift operator and standard library numeric types.
## ethers-contract-abigen

View File

@ -89,6 +89,12 @@ impl Sign {
}
/// Little-endian 256-bit signed integer.
///
/// ## Diversion from standard numeric types
/// The right shift operator on I256 doesn't act in the same manner as standard numeric types
/// (e.g. `i8`, `i16` etc). On standard types if the number is negative right shift will perform
/// an arithmetic shift, whereas on I256 this will perform a bit-wise shift.
/// Arithmetic shift on I256 is done via the [asr](I256::asr) and [asl](I256::asl) functions.
#[derive(Clone, Copy, Default, Deserialize, Eq, Hash, PartialEq, Serialize)]
#[serde(transparent)]
pub struct I256(U256);