Bitwise or.

This commit is contained in:
Adrien Guatto 2011-12-06 17:46:35 +01:00
parent a1ba01ab90
commit 0f71dbe145
4 changed files with 5 additions and 2 deletions

View file

@ -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 *)

View file

@ -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)

View file

@ -117,6 +117,7 @@ and op ff (f, e_l) =
| "<<<" -> "<<"
| ">>>" -> ">>"
| "&&&" -> "&"
| "|||" -> "|"
| op -> op
in
match Names.modul f with

View file

@ -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)