diff --git a/CHANGELOG.md b/CHANGELOG.md index 9de5209d..f7f4547a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ethers-core/src/types/i256.rs b/ethers-core/src/types/i256.rs index d6eec01a..b3bc4ae5 100644 --- a/ethers-core/src/types/i256.rs +++ b/ethers-core/src/types/i256.rs @@ -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);