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-util/nrrd-types.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/c-util/nrrd-types.sml

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

revision 1478, Thu Sep 1 13:09:11 2011 UTC revision 1479, Fri Sep 2 14:17:54 2011 UTC
# Line 36  Line 36 
36             | _ => raise Fail(concat["trNrrdType(", Ty.toString ty, ")"])             | _ => raise Fail(concat["trNrrdType(", Ty.toString ty, ")"])
37           (* end case *))           (* end case *))
38    
39      (* translate a TreeIL type and shape to the correct size in memory *)
40        fun toNrrdSize ty = let
41            val num : IntInf.int = (case ty
42              of Ty.BoolTy => 0 : IntInf.int
43               | Ty.StringTy => 0 : IntInf.int
44               | Ty.IVecTy 1 => 1 : IntInf.int
45               | Ty.IVecTy n => IntInf.fromInt n
46               | Ty.TensorTy[] => 1 : IntInf.int
47               | Ty.TensorTy[n] => IntInf.fromInt n
48               | Ty.TensorTy[n, m] => IntInf.fromInt (n * m)
49               | Ty.AddrTy(ImageInfo.ImgInfo{...}) => 0 : IntInf.int
50               | Ty.ImageTy(ImageInfo.ImgInfo{...}) => 0 : IntInf.int
51               | _ => raise Fail(concat["trNrrdType(", Ty.toString ty, ")"])
52             (* end case *))
53            in
54                num * (if !N.doublePrecision then 8 else 4)
55            end
56    
57      end (* local *)      end (* local *)
58    end    end

Legend:
Removed from v.1478  
changed lines
  Added in v.1479

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