File tree 1 file changed +8
-4
lines changed
src/c/implicit_conversions
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,13 @@ pub enum IntegerRank {
10
10
Int ,
11
11
Long ,
12
12
LongLong ,
13
+ Size ,
13
14
FixedInt ( BitUnits ) ,
14
15
}
15
16
16
17
impl IntegerRank {
17
- pub fn compare_for_target ( left : Self , right : Self , target : & Target ) -> Ordering {
18
- let left_precision = left. precision ( target) ;
19
- let right_precision = right. precision ( target) ;
20
- left_precision. cmp ( & right_precision)
18
+ pub fn compare_for_target ( self , other : & Self , target : & Target ) -> Ordering {
19
+ self . precision ( target) . cmp ( & other. precision ( target) )
21
20
}
22
21
23
22
pub fn precision ( & self , target : & Target ) -> IntegerPrecision {
@@ -30,6 +29,11 @@ impl IntegerRank {
30
29
IntegerRank :: LongLong => {
31
30
IntegerPrecision :: flexible ( target. longlong_layout ( ) . width . to_bits ( ) )
32
31
}
32
+ IntegerRank :: Size => {
33
+ // This means that size types have the same effective rank as the type they would
34
+ // be in C for this target.
35
+ IntegerPrecision :: flexible ( target. size_layout ( ) . width . to_bits ( ) )
36
+ }
33
37
IntegerRank :: FixedInt ( bits) => IntegerPrecision :: fixed ( * bits) ,
34
38
}
35
39
}
You can’t perform that action at this time.
0 commit comments