evmil/util/
word256.rs

1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5//    http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12use ruint::{Uint};
13use crate::util;
14
15/// Represents a `256` bit word.  This is very similar what a `u256`
16/// would be, but where all operations employ modulo arithmetic.
17#[allow(non_camel_case_types)]
18pub type w256 = Uint<256,4>;
19
20pub const W256_ZERO : w256 = w256::from_limbs([0,0,0,0]);
21pub const W256_ONE : w256 = w256::from_limbs([1,0,0,0]);
22pub const W256_TWO : w256  = w256::from_limbs([2,0,0,0]);
23pub const W256_THREE : w256  = w256::from_limbs([3,0,0,0]);
24pub const W256_THIRTYTWO : w256  = w256::from_limbs([32,0,0,0]);
25
26// =====================================================================
27// Min / Max
28// =====================================================================
29
30impl util::Max for w256 {
31    const MAX: Self = w256::MAX;
32}
33
34impl util::Min for w256 {
35    const MIN: Self = w256::MIN;
36}