irox_tools/primitives/
u128.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: MIT
// Copyright 2024 IROX Contributors
//

use crate::{ToF64, WrappingAdd, WrappingMul, WrappingSub};

impl WrappingAdd for u128 {
    fn wrapping_add(&self, rhs: Self) -> Self {
        u128::wrapping_add(*self, rhs)
    }
}
impl WrappingSub for u128 {
    fn wrapping_sub(&self, rhs: Self) -> Self {
        u128::wrapping_sub(*self, rhs)
    }
}
impl WrappingMul for u128 {
    fn wrapping_mul(&self, rhs: Self) -> Self {
        u128::wrapping_mul(*self, rhs)
    }
}
impl WrappingAdd for i128 {
    fn wrapping_add(&self, rhs: Self) -> Self {
        i128::wrapping_add(*self, rhs)
    }
}
impl WrappingSub for i128 {
    fn wrapping_sub(&self, rhs: Self) -> Self {
        i128::wrapping_sub(*self, rhs)
    }
}
impl WrappingMul for i128 {
    fn wrapping_mul(&self, rhs: Self) -> Self {
        i128::wrapping_mul(*self, rhs)
    }
}
impl ToF64 for i128 {
    fn to_f64(&self) -> f64 {
        *self as f64
    }
}
impl ToF64 for u128 {
    fn to_f64(&self) -> f64 {
        *self as f64
    }
}