Guest User

Untitled

a guest
Feb 16th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. --- cmmgen.ml.orig 2008-06-02 15:35:14.000626000 -0400
  2. +++ cmmgen.ml 2008-06-02 16:32:42.000314000 -0400
  3. @@ -173,22 +173,26 @@
  4.  
  5. let test_bool = function
  6. Cop(Caddi, [Cop(Clsl, [c; Cconst_int 1]); Cconst_int 1]) -> c
  7. | Cop(Clsl, [c; Cconst_int 1]) -> c
  8. | c -> Cop(Ccmpi Cne, [c; Cconst_int 1])
  9.  
  10. (* Float *)
  11.  
  12. let box_float c = Cop(Calloc, [alloc_float_header; c])
  13.  
  14. -let unbox_float = function
  15. +let rec unbox_float = function
  16. Cop(Calloc, [header; c]) -> c
  17. + | Clet(id, exp, body) -> Clet(id, exp, unbox_float body)
  18. + | Cifthenelse(cond, e1, e2) -> Cifthenelse(cond, unbox_float e1, unbox_float e2)
  19. + | Csequence(e1, e2) -> Csequence(e1, unbox_float e2)
  20. + (* do we need to push through more constructs ? *)
  21. | c -> Cop(Cload Double_u, [c])
  22.  
  23. (* Complex *)
  24.  
  25. let box_complex c_re c_im =
  26. Cop(Calloc, [alloc_floatarray_header 2; c_re; c_im])
  27.  
  28. let complex_re c = Cop(Cload Double_u, [c])
  29. let complex_im c = Cop(Cload Double_u,
  30. [Cop(Cadda, [c; Cconst_int size_float])])
Add Comment
Please, Sign In to add comment