@@ -485,24 +485,28 @@ impl<'a> FunctionTranslator<'a> {
485485 let lhs = self . translate_expr ( lhs_id, decl, decls) ;
486486 let rhs = self . translate_expr ( rhs_id, decl, decls) ;
487487 let t = decl. types [ lhs_id] ;
488- if * t == crate :: types:: Type :: Int32 {
489- self . builder . ins ( ) . imul ( lhs, rhs)
490- } else if * t == crate :: types:: Type :: Float32 {
491- self . builder . ins ( ) . fmul ( lhs, rhs)
492- } else {
493- todo ! ( )
488+ match * t {
489+ crate :: types:: Type :: Int32 | crate :: types:: Type :: UInt32 | crate :: types:: Type :: Int8 | crate :: types:: Type :: UInt8 => {
490+ self . builder . ins ( ) . imul ( lhs, rhs)
491+ }
492+ crate :: types:: Type :: Float32 | crate :: types:: Type :: Float64 => {
493+ self . builder . ins ( ) . fmul ( lhs, rhs)
494+ }
495+ _ => todo ! ( ) ,
494496 }
495497 }
496498 Binop :: Div => {
497499 let lhs = self . translate_expr ( lhs_id, decl, decls) ;
498500 let rhs = self . translate_expr ( rhs_id, decl, decls) ;
499501 let t = decl. types [ lhs_id] ;
500- if * t == crate :: types:: Type :: Int32 {
501- self . builder . ins ( ) . udiv ( lhs, rhs)
502- } else if * t == crate :: types:: Type :: Float32 {
503- self . builder . ins ( ) . fdiv ( lhs, rhs)
504- } else {
505- todo ! ( )
502+ match * t {
503+ crate :: types:: Type :: Int32 | crate :: types:: Type :: UInt32 | crate :: types:: Type :: Int8 | crate :: types:: Type :: UInt8 => {
504+ self . builder . ins ( ) . udiv ( lhs, rhs)
505+ }
506+ crate :: types:: Type :: Float32 | crate :: types:: Type :: Float64 => {
507+ self . builder . ins ( ) . fdiv ( lhs, rhs)
508+ }
509+ _ => todo ! ( ) ,
506510 }
507511 }
508512 Binop :: Assign => {
0 commit comments