wider_primitives/stable_ops/
u384.rs

1use core::cmp;
2use core::ops;
3use core::str;
4use crate::u256;
5use crate::u384;
6
7impl cmp::PartialOrd for u384 {
8    fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
9        Some(self.cmp(other))
10    }
11}
12
13impl cmp::Ord for u384 {
14    fn cmp(&self, other: &Self) -> cmp::Ordering {
15        self.inner.compare_unsigned(&other.inner)
16    }
17}
18
19impl ops::Add for &u384 {
20    type Output = u384;
21
22    fn add(self, rhs: Self) -> Self::Output {
23        (*self).add(*rhs)
24    }
25}
26
27impl ops::Add<u384> for &u384 {
28    type Output = u384;
29
30    fn add(self, rhs: u384) -> Self::Output {
31        (*self).add(rhs)
32    }
33}
34
35impl ops::Add<&u384> for u384 {
36    type Output = Self;
37
38    fn add(self, rhs: &u384) -> Self::Output {
39        self.add(*rhs)
40    }
41}
42
43impl ops::Add for u384 {
44    type Output = Self;
45
46    fn add(self, rhs: Self) -> Self::Output {
47        self.add(rhs)
48    }
49}
50
51impl ops::AddAssign for u384 {
52    fn add_assign(&mut self, rhs: Self) {
53        *self = *self + rhs;
54    }
55}
56
57impl ops::AddAssign<&u384> for u384 {
58    fn add_assign(&mut self, rhs: &u384) {
59        *self = *self + *rhs;
60    }
61}
62
63impl ops::Sub for &u384 {
64    type Output = u384;
65
66    fn sub(self, rhs: Self) -> Self::Output {
67        (*self).sub(*rhs)
68    }
69}
70
71impl ops::Sub<u384> for &u384 {
72    type Output = u384;
73
74    fn sub(self, rhs: u384) -> Self::Output {
75        (*self).sub(rhs)
76    }
77}
78
79impl ops::Sub<&u384> for u384 {
80    type Output = Self;
81
82    fn sub(self, rhs: &u384) -> Self::Output {
83        self.sub(*rhs)
84    }
85}
86
87impl ops::Sub for u384 {
88    type Output = Self;
89
90    fn sub(self, rhs: Self) -> Self::Output {
91        self.sub(rhs)
92    }
93}
94
95impl ops::SubAssign for u384 {
96    fn sub_assign(&mut self, rhs: Self) {
97        *self = *self - rhs;
98    }
99}
100
101impl ops::SubAssign<&u384> for u384 {
102    fn sub_assign(&mut self, rhs: &u384) {
103        *self = *self - *rhs;
104    }
105}
106
107impl ops::Mul<&u64> for &u384 {
108    type Output = u384;
109
110    fn mul(self, rhs: &u64) -> Self::Output {
111        (*self).short_mul(*rhs)
112    }
113}
114
115impl ops::Mul<u64> for &u384 {
116    type Output = u384;
117
118    fn mul(self, rhs: u64) -> Self::Output {
119        (*self).short_mul(rhs)
120    }
121}
122
123impl ops::Mul<&u64> for u384 {
124    type Output = u384;
125
126    fn mul(self, rhs: &u64) -> Self::Output {
127        self.short_mul(*rhs)
128    }
129}
130
131impl ops::Mul<u64> for u384 {
132    type Output = u384;
133
134    fn mul(self, rhs: u64) -> Self::Output {
135        self.short_mul(rhs)
136    }
137}
138
139impl ops::Mul for &u384 {
140    type Output = u384;
141
142    fn mul(self, rhs: Self) -> Self::Output {
143        (*self).mul(*rhs)
144    }
145}
146
147impl ops::Mul<u384> for &u384 {
148    type Output = u384;
149
150    fn mul(self, rhs: u384) -> Self::Output {
151        (*self).mul(rhs)
152    }
153}
154
155impl ops::Mul<&u384> for u384 {
156    type Output = Self;
157
158    fn mul(self, rhs: &u384) -> Self::Output {
159        self.mul(*rhs)
160    }
161}
162
163impl ops::Mul for u384 {
164    type Output = Self;
165
166    fn mul(self, rhs: Self) -> Self::Output {
167        self.mul(rhs)
168    }
169}
170
171impl ops::MulAssign for u384 {
172    fn mul_assign(&mut self, rhs: Self) {
173        *self = *self * rhs;
174    }
175}
176
177impl ops::MulAssign<&u384> for u384 {
178    fn mul_assign(&mut self, rhs: &u384) {
179        *self = *self * *rhs;
180    }
181}
182
183impl ops::MulAssign<u64> for u384 {
184    fn mul_assign(&mut self, rhs: u64) {
185        *self = *self * rhs;
186    }
187}
188
189impl ops::MulAssign<&u64> for u384 {
190    fn mul_assign(&mut self, rhs: &u64) {
191        *self = *self * *rhs;
192    }
193}
194
195impl ops::Div<&u64> for &u384 {
196    type Output = u384;
197
198    fn div(self, rhs: &u64) -> Self::Output {
199        (*self).short_div(*rhs)
200    }
201}
202
203impl ops::Div<u64> for &u384 {
204    type Output = u384;
205
206    fn div(self, rhs: u64) -> Self::Output {
207        (*self).short_div(rhs)
208    }
209}
210
211impl ops::Div<&u64> for u384 {
212    type Output = u384;
213
214    fn div(self, rhs: &u64) -> Self::Output {
215        self.short_div(*rhs)
216    }
217}
218
219impl ops::Div<u64> for u384 {
220    type Output = u384;
221
222    fn div(self, rhs: u64) -> Self::Output {
223        self.short_div(rhs)
224    }
225}
226
227impl ops::Div for &u384 {
228    type Output = u384;
229
230    fn div(self, rhs: Self) -> Self::Output {
231        (*self).div(*rhs)
232    }
233}
234
235impl ops::Div<u384> for &u384 {
236    type Output = u384;
237
238    fn div(self, rhs: u384) -> Self::Output {
239        (*self).div(rhs)
240    }
241}
242
243impl ops::Div<&u384> for u384 {
244    type Output = Self;
245
246    fn div(self, rhs: &u384) -> Self::Output {
247        self.div(*rhs)
248    }
249}
250
251impl ops::Div for u384 {
252    type Output = Self;
253
254    fn div(self, rhs: Self) -> Self::Output {
255        self.div(rhs)
256    }
257}
258
259impl ops::DivAssign for u384 {
260    fn div_assign(&mut self, rhs: Self) {
261        *self = *self / rhs;
262    }
263}
264
265impl ops::DivAssign<&u384> for u384 {
266    fn div_assign(&mut self, rhs: &u384) {
267        *self = *self / *rhs;
268    }
269}
270
271impl ops::DivAssign<u64> for u384 {
272    fn div_assign(&mut self, rhs: u64) {
273        *self = *self / rhs;
274    }
275}
276
277impl ops::DivAssign<&u64> for u384 {
278    fn div_assign(&mut self, rhs: &u64) {
279        *self = *self / *rhs;
280    }
281}
282
283impl ops::Rem<&u64> for &u384 {
284    type Output = u64;
285
286    fn rem(self, rhs: &u64) -> Self::Output {
287        (*self).short_rem(*rhs)
288    }
289}
290
291impl ops::Rem<u64> for &u384 {
292    type Output = u64;
293
294    fn rem(self, rhs: u64) -> Self::Output {
295        (*self).short_rem(rhs)
296    }
297}
298
299impl ops::Rem<&u64> for u384 {
300    type Output = u64;
301
302    fn rem(self, rhs: &u64) -> Self::Output {
303        self.short_rem(*rhs)
304    }
305}
306
307impl ops::Rem<u64> for u384 {
308    type Output = u64;
309
310    fn rem(self, rhs: u64) -> Self::Output {
311        self.short_rem(rhs)
312    }
313}
314
315impl ops::Rem for &u384 {
316    type Output = u384;
317
318    fn rem(self, rhs: Self) -> Self::Output {
319        (*self).rem(*rhs)
320    }
321}
322
323impl ops::Rem<u384> for &u384 {
324    type Output = u384;
325
326    fn rem(self, rhs: u384) -> Self::Output {
327        (*self).rem(rhs)
328    }
329}
330
331impl ops::Rem<&u384> for u384 {
332    type Output = Self;
333
334    fn rem(self, rhs: &u384) -> Self::Output {
335        self.rem(*rhs)
336    }
337}
338
339impl ops::Rem for u384 {
340    type Output = Self;
341
342    fn rem(self, rhs: Self) -> Self::Output {
343        self.rem(rhs)
344    }
345}
346
347impl ops::RemAssign for u384 {
348    fn rem_assign(&mut self, rhs: Self) {
349        *self = *self % rhs;
350    }
351}
352
353impl ops::RemAssign<&u384> for u384 {
354    fn rem_assign(&mut self, rhs: &u384) {
355        *self = *self % *rhs;
356    }
357}
358
359impl ops::RemAssign<u64> for u384 {
360    fn rem_assign(&mut self, rhs: u64) {
361        *self = Self::from_u64(*self % rhs);
362    }
363}
364
365impl ops::RemAssign<&u64> for u384 {
366    fn rem_assign(&mut self, rhs: &u64) {
367        *self = Self::from_u64(*self % *rhs);
368    }
369}
370
371impl ops::Not for u384 {
372    type Output = Self;
373
374    fn not(self) -> Self::Output {
375        self.not()
376    }
377}
378
379impl ops::Not for &u384 {
380    type Output = u384;
381
382    fn not(self) -> Self::Output {
383        (*self).not()
384    }
385}
386
387impl ops::BitAnd for &u384 {
388    type Output = u384;
389
390    fn bitand(self, rhs: Self) -> Self::Output {
391        (*self).bitand(*rhs)
392    }
393}
394
395impl ops::BitAnd<u384> for &u384 {
396    type Output = u384;
397
398    fn bitand(self, rhs: u384) -> Self::Output {
399        (*self).bitand(rhs)
400    }
401}
402
403impl ops::BitAnd<&u384> for u384 {
404    type Output = Self;
405
406    fn bitand(self, rhs: &u384) -> Self::Output {
407        self.bitand(*rhs)
408    }
409}
410
411impl ops::BitAnd for u384 {
412    type Output = Self;
413
414    fn bitand(self, rhs: Self) -> Self::Output {
415        self.bitand(rhs)
416    }
417}
418
419impl ops::BitAndAssign for u384 {
420    fn bitand_assign(&mut self, rhs: Self) {
421        *self = *self & rhs;
422    }
423}
424
425impl ops::BitAndAssign<&u384> for u384 {
426    fn bitand_assign(&mut self, rhs: &Self) {
427        *self = *self & *rhs;
428    }
429}
430
431impl ops::BitOr for &u384 {
432    type Output = u384;
433
434    fn bitor(self, rhs: Self) -> Self::Output {
435        (*self).bitor(*rhs)
436    }
437}
438
439impl ops::BitOr<u384> for &u384 {
440    type Output = u384;
441
442    fn bitor(self, rhs: u384) -> Self::Output {
443        (*self).bitor(rhs)
444    }
445}
446
447impl ops::BitOr<&u384> for u384 {
448    type Output = Self;
449
450    fn bitor(self, rhs: &u384) -> Self::Output {
451        self.bitor(*rhs)
452    }
453}
454
455impl ops::BitOr for u384 {
456    type Output = Self;
457
458    fn bitor(self, rhs: Self) -> Self::Output {
459        self.bitor(rhs)
460    }
461}
462
463impl ops::BitOrAssign for u384 {
464    fn bitor_assign(&mut self, rhs: Self) {
465        *self = *self | rhs;
466    }
467}
468
469impl ops::BitOrAssign<&u384> for u384 {
470    fn bitor_assign(&mut self, rhs: &Self) {
471        *self = *self | *rhs;
472    }
473}
474
475impl ops::BitXor for &u384 {
476    type Output = u384;
477
478    fn bitxor(self, rhs: Self) -> Self::Output {
479        (*self).bitxor(*rhs)
480    }
481}
482
483impl ops::BitXor<u384> for &u384 {
484    type Output = u384;
485
486    fn bitxor(self, rhs: u384) -> Self::Output {
487        (*self).bitxor(rhs)
488    }
489}
490
491impl ops::BitXor<&u384> for u384 {
492    type Output = Self;
493
494    fn bitxor(self, rhs: &u384) -> Self::Output {
495        self.bitxor(*rhs)
496    }
497}
498
499impl ops::BitXor for u384 {
500    type Output = Self;
501
502    fn bitxor(self, rhs: Self) -> Self::Output {
503        self.bitxor(rhs)
504    }
505}
506
507impl ops::BitXorAssign for u384 {
508    fn bitxor_assign(&mut self, rhs: Self) {
509        *self = *self ^ rhs;
510    }
511}
512
513impl ops::BitXorAssign<&u384> for u384 {
514    fn bitxor_assign(&mut self, rhs: &Self) {
515        *self = *self ^ *rhs;
516    }
517}
518
519impl From<u8> for u384 {
520    fn from(n: u8) -> Self {
521        Self::from_u8(n)
522    }
523}
524
525impl From<u16> for u384 {
526    fn from(n: u16) -> Self {
527        Self::from_u16(n)
528    }
529}
530
531impl From<u32> for u384 {
532    fn from(n: u32) -> Self {
533        Self::from_u32(n)
534    }
535}
536
537impl From<u64> for u384 {
538    fn from(n: u64) -> Self {
539        Self::from_u64(n)
540    }
541}
542
543impl From<u128> for u384 {
544    fn from(n: u128) -> Self {
545        Self::from_u128(n)
546    }
547}
548
549impl From<u256> for u384 {
550    fn from(n: u256) -> Self {
551        Self::from_u256(n)
552    }
553}
554
555impl str::FromStr for u384 {
556    type Err = crate::ParseIntError;
557
558    fn from_str(src: &str) -> Result<Self, Self::Err> {
559        Self::from_str(src)
560    }
561}
562
563impl ops::Shl<&u32> for u384 {
564    type Output = Self;
565
566    fn shl(self, rhs: &u32) -> Self::Output {
567        self.shl(*rhs)
568    }
569}
570
571impl ops::Shl<u32> for u384 {
572    type Output = Self;
573
574    fn shl(self, rhs: u32) -> Self::Output {
575        self.shl(rhs)
576    }
577}
578
579impl ops::ShlAssign<&u32> for u384 {
580    fn shl_assign(&mut self, rhs: &u32) {
581        *self = *self << rhs;
582    }
583}
584
585impl ops::ShlAssign<u32> for u384 {
586    fn shl_assign(&mut self, rhs: u32) {
587        *self = *self << rhs;
588    }
589}
590
591impl ops::Shr<&u32> for u384 {
592    type Output = Self;
593
594    fn shr(self, rhs: &u32) -> Self::Output {
595        self.shr(*rhs)
596    }
597}
598
599impl ops::Shr<u32> for u384 {
600    type Output = Self;
601
602    fn shr(self, rhs: u32) -> Self::Output {
603        self.shr(rhs)
604    }
605}
606
607impl ops::ShrAssign<&u32> for u384 {
608    fn shr_assign(&mut self, rhs: &u32) {
609        *self = *self >> rhs;
610    }
611}
612
613impl ops::ShrAssign<u32> for u384 {
614    fn shr_assign(&mut self, rhs: u32) {
615        *self = *self >> rhs;
616    }
617}