git.annexia.org
/
ocaml-bitstring.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1cd333c
)
The attached patch is necessary to work around a bug in the parsing in
author
Richard W.M. Jones
<rich@annexia.org>
Tue, 26 Aug 2008 08:13:07 +0000
(08:13 +0000)
committer
Richard W.M. Jones
<rich@annexia.org>
Tue, 26 Aug 2008 08:13:07 +0000
(08:13 +0000)
OCaml 3.10.0 (fixed in 3.10.2 and later). It doesn't affect
performance of the generated code.
pa_bitstring.ml
patch
|
blob
|
history
diff --git
a/pa_bitstring.ml
b/pa_bitstring.ml
index
664e62d
..
63c280e
100644
(file)
--- a/
pa_bitstring.ml
+++ b/
pa_bitstring.ml
@@
-55,9
+55,16
@@
let rec expr_is_constant = function
(match expr_is_constant a, expr_is_constant b with
| Some a, Some b -> (* Integer binary operations. *)
let ops = ["+", (+); "-", (-); "*", ( * ); "/", (/);
(match expr_is_constant a, expr_is_constant b with
| Some a, Some b -> (* Integer binary operations. *)
let ops = ["+", (+); "-", (-); "*", ( * ); "/", (/);
- "land", (land); "lor", (lor); "lxor", (lxor);
- "lsl", (lsl); "lsr", (lsr); "asr", (asr);
- "mod", (mod)] in
+ (* NB: explicit fun .. -> is necessary here to work
+ * around a camlp4 bug in OCaml 3.10.0.
+ *)
+ "land", (fun a b -> a land b);
+ "lor", (fun a b -> a lor b);
+ "lxor", (fun a b -> a lxor b);
+ "lsl", (fun a b -> a lsl b);
+ "lsr", (fun a b -> a lsr b);
+ "asr", (fun a b -> a asr b);
+ "mod", (fun a b -> a mod b)] in
(try Some ((List.assoc op ops) a b) with Not_found -> None)
| _ -> None)
| _ -> None
(try Some ((List.assoc op ops) a b) with Not_found -> None)
| _ -> None)
| _ -> None