From 0f71dbe14573bb2fe01329d858526590a581253c Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Tue, 6 Dec 2011 17:46:35 +0100 Subject: [PATCH] Bitwise or. --- compiler/global/static.ml | 1 + compiler/obc/c/cgen.ml | 4 ++-- compiler/obc/java/java_printer.ml | 1 + lib/pervasives.epi | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/global/static.ml b/compiler/global/static.ml index 1560142..f9f3ffa 100644 --- a/compiler/global/static.ml +++ b/compiler/global/static.ml @@ -101,6 +101,7 @@ let apply_op partial loc op se_list = | "~~", [Sint n] -> Sint (lnot n) | "~-.", [Sfloat f] -> Sfloat (-. f) | "&&&", [Sint n1; Sint n2] -> Sint (n1 land n2) + | "|||", [Sint n1; Sint n2] -> Sint (n1 lor n2) | f,_ -> Misc.internal_error ("Static evaluation failed of the pervasive operator "^f) ) else ( (* symbolic evaluation *) diff --git a/compiler/obc/c/cgen.ml b/compiler/obc/c/cgen.ml index 46c1f6f..42993a3 100644 --- a/compiler/obc/c/cgen.ml +++ b/compiler/obc/c/cgen.ml @@ -109,7 +109,7 @@ let copname = function | "+." -> "+" | "-." -> "-" | "<" -> "<" | ">" -> ">" | "<=" -> "<=" | ">=" -> ">=" | "<=." -> "<=" | "<." -> "<" | ">=." -> ">=" | ">." -> ">" | "~-" -> "-" | "not" -> "!" | "%" -> "%" - | ">>>" -> ">>" | "<<<" -> "<<" | "&&&" -> "&" + | ">>>" -> ">>" | "<<<" -> "<<" | "&&&" -> "&" | "|||" -> "|" | op -> op (** Translates an Obc var_dec to a tuple (name, cty). *) @@ -274,7 +274,7 @@ and cop_of_op_aux op_name cexps = match op_name with "=" | "<>" | "&" | "or" | "+" | "-" | "*" | "/" - | "*." | "/." | "+." | "-." | "%" | "<<<" | ">>>" | "&&&" + | "*." | "/." | "+." | "-." | "%" | "<<<" | ">>>" | "&&&" | "|||" | "<" | ">" | "<=" | ">=" | "<=." | "<." | ">=." | ">."), [el;er] -> Cbop (copname op, el, er) | _ -> Cfun_call(op, cexps) diff --git a/compiler/obc/java/java_printer.ml b/compiler/obc/java/java_printer.ml index ca10fb4..050ca83 100644 --- a/compiler/obc/java/java_printer.ml +++ b/compiler/obc/java/java_printer.ml @@ -117,6 +117,7 @@ and op ff (f, e_l) = | "<<<" -> "<<" | ">>>" -> ">>" | "&&&" -> "&" + | "|||" -> "|" | op -> op in match Names.modul f with diff --git a/lib/pervasives.epi b/lib/pervasives.epi index 8b48063..5c79c50 100644 --- a/lib/pervasives.epi +++ b/lib/pervasives.epi @@ -31,6 +31,7 @@ val fun (~~)(int) returns (int) val fun (>>>)(int;int) returns (int) val fun (<<<)(int;int) returns (int) val fun (&&&)(int;int) returns (int) +val fun (|||)(int;int) returns (int) val fun (~-.)(float) returns (float) val fun do_stuff(int) returns (int) val fun between(int;int) returns (int)