|
@@ -1306,8 +1306,8 @@ module Printer = struct
|
|
|
Printf.sprintf "%s(%s,%s)" (third ops) (print_expr pctx e1) (print_expr pctx e2)
|
|
|
| _,_ -> Printf.sprintf "(%s %s %s)" (print_expr pctx e1) (snd ops) (print_expr pctx e2))
|
|
|
| TBinop(OpMod,e1,e2) when (is_type1 "" "Int")(e1.etype) && (is_type1 "" "Int")(e2.etype) ->
|
|
|
- (match e1.eexpr with
|
|
|
- | TConst(TInt(x)) when (Int32.to_int x) >= 0 ->
|
|
|
+ (match e1.eexpr, e2.eexpr with
|
|
|
+ | TConst(TInt(x1)), TConst(TInt(x2)) when (Int32.to_int x1) >= 0 && (Int32.to_int x2) >= 0 ->
|
|
|
(* constant optimization *)
|
|
|
Printf.sprintf "%s %% %s" (print_expr pctx e1) (print_expr pctx e2)
|
|
|
| _ ->
|