aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cparser/Cutil.ml8
-rw-r--r--cparser/Cutil.mli4
2 files changed, 8 insertions, 4 deletions
diff --git a/cparser/Cutil.ml b/cparser/Cutil.ml
index 20cdc038..9f893fb0 100644
--- a/cparser/Cutil.ml
+++ b/cparser/Cutil.ml
@@ -981,8 +981,12 @@ let int_pointer_conversion env tfrom tto =
(* Construct an integer constant *)
-let intconst v ik =
- { edesc = EConst(CInt(v, ik, "")); etyp = TInt(ik, []) }
+let intconst ?hex v ik =
+ let ist = match hex with
+ | Some hex when hex ->
+ Printf.sprintf "0x%LXU" v
+ | _ -> "" in
+ { edesc = EConst(CInt(v, ik, ist)); etyp = TInt(ik, []) }
(* Construct the 0 float constant of double type *)
diff --git a/cparser/Cutil.mli b/cparser/Cutil.mli
index ee3c7625..5e560e44 100644
--- a/cparser/Cutil.mli
+++ b/cparser/Cutil.mli
@@ -221,8 +221,8 @@ val field_of_arrow_access: Env.t -> typ -> string -> field
(* Constructors *)
-val intconst : int64 -> ikind -> exp
- (* Build expression for given integer constant. *)
+val intconst : ?hex:bool -> int64 -> ikind -> exp
+ (* Build expression for given integer constant with optional hex string. *)
val floatconst0 : exp
(* Build expression for (double)0. *)
val nullconst : exp