@@ -128,20 +128,28 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
128
128
}
129
129
130
130
fn const_uint_big ( & self , typ : Type < ' gcc > , num : u128 ) -> RValue < ' gcc > {
131
- let num64: Result < u64 , _ > = num. try_into ( ) ;
131
+ println ! ( "Num: {:?}" , num) ;
132
+ let num64: Result < i64 , _ > = num. try_into ( ) ;
132
133
if let Ok ( num) = num64 {
134
+ println ! ( "1" ) ;
133
135
// FIXME: workaround for a bug where libgccjit is expecting a constant.
134
136
// The operations >> 64 and | low are making the normal case a non-constant.
135
137
return self . context . new_rvalue_from_long ( typ, num as i64 ) ;
136
138
}
137
139
138
- // FIXME: use a new function new_rvalue_from_unsigned_long()?
139
- let low = self . context . new_rvalue_from_long ( self . u64_type , num as u64 as i64 ) ;
140
- let high = self . context . new_rvalue_from_long ( typ, ( num >> 64 ) as u64 as i64 ) ;
140
+ if num >> 64 != 0 {
141
+ println ! ( "2" ) ;
142
+ // FIXME: use a new function new_rvalue_from_unsigned_long()?
143
+ let low = self . context . new_rvalue_from_long ( self . u64_type , num as u64 as i64 ) ;
144
+ let high = self . context . new_rvalue_from_long ( typ, ( num >> 64 ) as u64 as i64 ) ;
141
145
142
- let sixty_four = self . context . new_rvalue_from_long ( typ, 64 ) ;
143
-
144
- ( high << sixty_four) | self . context . new_cast ( None , low, typ)
146
+ let sixty_four = self . context . new_rvalue_from_long ( typ, 64 ) ;
147
+ ( high << sixty_four) | self . context . new_cast ( None , low, typ)
148
+ }
149
+ else {
150
+ println ! ( "3" ) ;
151
+ self . context . new_rvalue_from_long ( typ, num as u64 as i64 )
152
+ }
145
153
146
154
/*unsafe {
147
155
let words = [u as u64, (u >> 64) as u64];
0 commit comments