Skip to content

Commit 7f46905

Browse files
committed
Add mul/div/rem tests
1 parent a467dd2 commit 7f46905

File tree

3 files changed

+5
-205
lines changed

3 files changed

+5
-205
lines changed

src/int/big.rs

Lines changed: 1 addition & 203 deletions
Original file line numberDiff line numberDiff line change
@@ -59,94 +59,7 @@ impl MinInt for i256 {
5959
const MAX: Self = Self([u64::MAX; 4]);
6060
}
6161

62-
// impl Int for u256 {
63-
// type OtherSign = i256;
64-
65-
// type UnsignedInt = u256;
66-
67-
// fn unsigned(self) -> Self::UnsignedInt {
68-
// self
69-
// }
70-
71-
// fn from_unsigned(unsigned: Self::UnsignedInt) -> Self {
72-
// todo!()
73-
// }
74-
75-
// fn from_bool(b: bool) -> Self {
76-
// todo!()
77-
// }
78-
79-
// fn logical_shr(self, other: u32) -> Self {
80-
// todo!()
81-
// }
82-
83-
// fn abs_diff(self, other: Self) -> Self::UnsignedInt {
84-
// todo!()
85-
// }
86-
87-
// fn is_zero(self) -> bool {
88-
// todo!()
89-
// }
90-
91-
// fn wrapping_neg(self) -> Self {
92-
// todo!()
93-
// }
94-
95-
// fn wrapping_add(self, other: Self) -> Self {
96-
// todo!()
97-
// }
98-
99-
// fn wrapping_mul(self, other: Self) -> Self {
100-
// todo!()
101-
// }
102-
103-
// fn wrapping_sub(self, other: Self) -> Self {
104-
// todo!()
105-
// }
106-
107-
// fn wrapping_shl(self, other: u32) -> Self {
108-
// todo!()
109-
// }
110-
111-
// fn wrapping_shr(self, other: u32) -> Self {
112-
// todo!()
113-
// }
114-
115-
// fn rotate_left(self, other: u32) -> Self {
116-
// todo!()
117-
// }
118-
119-
// fn overflowing_add(self, other: Self) -> (Self, bool) {
120-
// todo!()
121-
// }
122-
123-
// fn leading_zeros(self) -> u32 {
124-
// todo!()
125-
// }
126-
// }
127-
12862
// impl Int for i256 {
129-
130-
// fn unsigned(self) -> Self::UnsignedInt {
131-
// todo!()
132-
// }
133-
134-
// fn from_unsigned(unsigned: Self::UnsignedInt) -> Self {
135-
// todo!()
136-
// }
137-
138-
// fn from_bool(b: bool) -> Self {
139-
// todo!()
140-
// }
141-
142-
// fn logical_shr(self, other: u32) -> Self {
143-
// todo!()
144-
// }
145-
146-
// fn abs_diff(self, other: Self) -> Self::UnsignedInt {
147-
// todo!()
148-
// }
149-
15063
// fn is_zero(self) -> bool {
15164
// self == Self::ZERO
15265
// }
@@ -158,27 +71,7 @@ impl MinInt for i256 {
15871
// fn wrapping_add(self, other: Self) -> Self {
15972
// self.overflowing_add(other).0
16073
// }
161-
162-
// fn wrapping_mul(self, other: Self) -> Self {
163-
// todo!()
164-
// }
165-
166-
// fn wrapping_sub(self, other: Self) -> Self {
167-
// todo!()
168-
// }
169-
170-
// fn wrapping_shl(self, other: u32) -> Self {
171-
// todo!()
172-
// }
173-
174-
// fn wrapping_shr(self, other: u32) -> Self {
175-
// todo!()
176-
// }
177-
178-
// fn rotate_left(self, other: u32) -> Self {
179-
// todo!()
180-
// }
181-
74+
//
18275
// fn overflowing_add(self, other: Self) -> (Self, bool) {
18376
// let x0 = (u128::from(self.0[0])).wrapping_add(u128::from(other.0[0]));
18477
// let v0 = x0 as u64;
@@ -204,10 +97,6 @@ impl MinInt for i256 {
20497

20598
// (Self([v0, v1, v2, v3]), c3 > 0)
20699
// }
207-
208-
// fn leading_zeros(self) -> u32 {
209-
// todo!()
210-
// }
211100
// }
212101

213102
macro_rules! impl_common {
@@ -298,49 +187,6 @@ macro_rules! impl_common {
298187
impl_common!(i256);
299188
impl_common!(u256);
300189

301-
// impl ops::Sub for u256 {
302-
// type Output = Self;
303-
304-
// fn sub(self, rhs: Self) -> Self::Output {
305-
// todo!()
306-
// }
307-
// }
308-
309-
// impl ops::Sub for i256 {
310-
// type Output = Self;
311-
312-
// fn sub(self, rhs: Self) -> Self::Output {
313-
// todo!()
314-
// }
315-
// }
316-
317-
// impl ops::SubAssign for u256 {
318-
// fn sub_assign(&mut self, rhs: Self) {
319-
// todo!()
320-
// }
321-
// }
322-
323-
// impl ops::SubAssign for i256 {
324-
// fn sub_assign(&mut self, rhs: Self) {
325-
// todo!()
326-
// }
327-
// }
328-
329-
// impl ops::Div for u256 {
330-
// type Output = Self;
331-
332-
// fn div(self, rhs: Self) -> Self::Output {
333-
// todo!()
334-
// }
335-
// }
336-
337-
// impl ops::Div for i256 {
338-
// type Output = Self;
339-
340-
// fn div(self, rhs: Self) -> Self::Output {
341-
// todo!()
342-
// }
343-
// }
344190

345191
impl ops::Shl<u32> for u256 {
346192
type Output = Self;
@@ -350,54 +196,6 @@ impl ops::Shl<u32> for u256 {
350196
}
351197
}
352198

353-
// impl ops::Shl<u32> for i256 {
354-
// type Output = Self;
355-
356-
// fn shl(self, rhs: u32) -> Self::Output {
357-
// todo!()
358-
// }
359-
// }
360-
361-
// impl ops::Shr<u32> for u256 {
362-
// type Output = Self;
363-
364-
// fn shr(self, rhs: u32) -> Self::Output {
365-
// todo!()
366-
// }
367-
// }
368-
369-
// impl ops::Shr<u32> for i256 {
370-
// type Output = Self;
371-
372-
// fn shr(self, rhs: u32) -> Self::Output {
373-
// todo!()
374-
// }
375-
// }
376-
377-
// impl ops::ShlAssign<i32> for u256 {
378-
// fn shl_assign(&mut self, rhs: i32) {
379-
// todo!()
380-
// }
381-
// }
382-
383-
// impl ops::ShlAssign<i32> for i256 {
384-
// fn shl_assign(&mut self, rhs: i32) {
385-
// todo!()
386-
// }
387-
// }
388-
389-
// impl ops::ShrAssign<u32> for u256 {
390-
// fn shr_assign(&mut self, rhs: u32) {
391-
// todo!()
392-
// }
393-
// }
394-
395-
// impl ops::ShrAssign<u32> for i256 {
396-
// fn shr_assign(&mut self, rhs: u32) {
397-
// todo!()
398-
// }
399-
// }
400-
401199
macro_rules! word {
402200
(1, $val:expr) => {
403201
(($val >> (32 * 3)) & Self::from(WORD_LO_MASK)) as u64

testcrate/tests/div_rem.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,14 @@ macro_rules! float {
136136
#[test]
137137
fn float_div() {
138138
use compiler_builtins::float::{
139-
div::{__divdf3, __divsf3},
139+
div::{__divdf3, __divsf3, __divtf3},
140140
Float,
141141
};
142142

143143
float!(
144144
f32, __divsf3;
145145
f64, __divdf3;
146+
f128, __dvtf3;
146147
);
147148
}
148149

testcrate/tests/mul.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ macro_rules! float_mul {
105105
#[test]
106106
fn float_mul() {
107107
use compiler_builtins::float::{
108-
mul::{__muldf3, __mulsf3},
108+
mul::{__muldf3, __mulsf3, __multf3},
109109
Float,
110110
};
111111

112112
float_mul!(
113113
f32, __mulsf3;
114114
f64, __muldf3;
115+
f128, __multf3;
115116
);
116117
}
117118

0 commit comments

Comments
 (0)