Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/c-target/c-target.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/c-target/c-target.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 753, Thu Apr 7 14:48:23 2011 UTC revision 754, Thu Apr 7 14:55:33 2011 UTC
# Line 344  Line 344 
344          fun || (E(e1, T_Bool), E(e2, T_Bool)) = E(CL.mkBinOp(e1, CL.#||, e2), T_Bool)          fun || (E(e1, T_Bool), E(e2, T_Bool)) = E(CL.mkBinOp(e1, CL.#||, e2), T_Bool)
345            | || _ = raise Fail "invalid arguments to ||"            | || _ = raise Fail "invalid arguments to ||"
346    
347          (* misc functions *)
348          local          local
349            fun checkTys (ty1, ty2) = (ty1 = ty2) andalso scalarTy ty1            fun checkTys (ty1, ty2) = (ty1 = ty2) andalso scalarTy ty1
350            fun binFn f (E(e1, ty1), E(e2, ty2)) =            fun binFn f (E(e1, ty1), E(e2, ty2)) =
# Line 351  Line 352 
352                    then E(CL.mkApply(f ty1, [e1, e2]), ty1)                    then E(CL.mkApply(f ty1, [e1, e2]), ty1)
353                    else raise Fail "invalid arguments to binary function"                    else raise Fail "invalid arguments to binary function"
354          in          in
       (* misc functions *)  
355          val min = binFn RN.min          val min = binFn RN.min
356          val max = binFn RN.max          val max = binFn RN.max
357            fun lerp (E(e1, ty1), E(e2, ty2), E(e3, T_Real)) =
358                  if (ty1 = ty2)
359                    then (case ty1
360                       of T_Real => E(CL.mkApply(RN.lerp 0, [e1, e2, e3]), T_Real)
361                        | T_Vec n => E(CL.mkApply(RN.lerp n, [e1, e2, e3]), ty1)
362                        | ty => raise Fail(concat["lerp<", TargetTy.toString ty, "> not supported"])
363                      (* end case *))
364                    else raise Fail "invalid arguments to lerp"
365              | lerp _ = raise Fail "invalid arguments to lerp"
366          end (* local *)          end (* local *)
367    
368        (* rounding *)        (* rounding *)

Legend:
Removed from v.753  
changed lines
  Added in v.754

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0