irox_tools/primitives/
u128.rs

1// SPDX-License-Identifier: MIT
2// Copyright 2024 IROX Contributors
3//
4
5use crate::{ToF64, WrappingAdd, WrappingMul, WrappingSub};
6
7impl WrappingAdd for u128 {
8    fn wrapping_add(&self, rhs: Self) -> Self {
9        u128::wrapping_add(*self, rhs)
10    }
11}
12impl WrappingSub for u128 {
13    fn wrapping_sub(&self, rhs: Self) -> Self {
14        u128::wrapping_sub(*self, rhs)
15    }
16}
17impl WrappingMul for u128 {
18    fn wrapping_mul(&self, rhs: Self) -> Self {
19        u128::wrapping_mul(*self, rhs)
20    }
21}
22impl WrappingAdd for i128 {
23    fn wrapping_add(&self, rhs: Self) -> Self {
24        i128::wrapping_add(*self, rhs)
25    }
26}
27impl WrappingSub for i128 {
28    fn wrapping_sub(&self, rhs: Self) -> Self {
29        i128::wrapping_sub(*self, rhs)
30    }
31}
32impl WrappingMul for i128 {
33    fn wrapping_mul(&self, rhs: Self) -> Self {
34        i128::wrapping_mul(*self, rhs)
35    }
36}
37impl ToF64 for i128 {
38    fn to_f64(&self) -> f64 {
39        *self as f64
40    }
41}
42impl ToF64 for u128 {
43    fn to_f64(&self) -> f64 {
44        *self as f64
45    }
46}