File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,14 +153,12 @@ macro_rules! isle_common_prelude_methods {
153153 }
154154
155155 #[ inline]
156- fn imm64_ilog2( & mut self , ty: Type , x: Imm64 ) -> Imm64 {
156+ fn imm64_ilog2( & mut self , ty: Type , x: Imm64 ) -> Option < Imm64 > {
157157 let type_width = ty. bits( ) ;
158158 assert!( type_width <= 64 ) ;
159159 let masked = ( x. bits( ) as u64 ) & self . ty_mask( ty) ;
160- let result = masked
161- . checked_ilog2( )
162- . unwrap_or_else( || panic!( "ilog2 overflow: {masked}" ) ) ;
163- Imm64 :: new( result. into( ) )
160+ let result = masked. checked_ilog2( ) ?;
161+ Some ( Imm64 :: new( result. into( ) ) )
164162 }
165163
166164 #[ inline]
Original file line number Diff line number Diff line change 103103(decl pure partial imm64_abs (Type Imm64) Imm64)
104104(extern constructor imm64_abs imm64_abs)
105105
106- (decl pure imm64_ilog2 (Type Imm64) Imm64)
106+ (decl pure partial imm64_ilog2 (Type Imm64) Imm64)
107107(extern constructor imm64_ilog2 imm64_ilog2)
108108
109109(decl pure imm64_umin (Type Imm64 Imm64) Imm64)
You can’t perform that action at this time.
0 commit comments