Commit b1eb3c67 authored by Julien Signoles's avatar Julien Signoles
Browse files

code factorization

parent c1ffa08a
...@@ -149,8 +149,8 @@ let get_set_suffix_and_arg e = ...@@ -149,8 +149,8 @@ let get_set_suffix_and_arg e =
| TFloat((FDouble | FFloat), _) -> | TFloat((FDouble | FFloat), _) ->
(* FFloat is a strict subset of FDouble (modulo exceptional numbers) (* FFloat is a strict subset of FDouble (modulo exceptional numbers)
Hence, calling [set_d] for both of them is sound. Hence, calling [set_d] for both of them is sound.
HOWEVER: the machdep MUST NOT be vulnerable to double rounding *) HOWEVER: the machdep MUST NOT be vulnerable to double rounding
(* TODO RATIONAL: check machdep *) [TODO] check the statement above *)
"_d", [ e ] "_d", [ e ]
| TFloat(FLongDouble, _) -> | TFloat(FLongDouble, _) ->
Error.not_yet "creating gmp from long double" Error.not_yet "creating gmp from long double"
...@@ -159,19 +159,7 @@ let get_set_suffix_and_arg e = ...@@ -159,19 +159,7 @@ let get_set_suffix_and_arg e =
let generic_affect ~loc fname lv ev e = let generic_affect ~loc fname lv ev e =
let ty = Cil.typeOf ev in let ty = Cil.typeOf ev in
if Z.is_t ty then begin if Z.is_t ty || Q.is_t ty then begin
assert
(* Missing cast/wrong typing happened in the past *)
(not (Q.is_t (Cil.typeOf e)));
let suf, args = get_set_suffix_and_arg e in
Misc.mk_call ~loc (fname ^ suf) (ev :: args)
end else if Q.is_t ty then begin
assert
(* Missing cast/wrong typing happened in the past *)
(not (Z.is_t (Cil.typeOf e)));
(* TODO RATIONAL: [from Fonenantsoa:]
If we try to factorize the following the above
then the result is different... why ?! *)
let suf, args = get_set_suffix_and_arg e in let suf, args = get_set_suffix_and_arg e in
Misc.mk_call ~loc (fname ^ suf) (ev :: args) Misc.mk_call ~loc (fname ^ suf) (ev :: args)
end else end else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment