[MLton-commit] r6644

Matthew Fluet fluet at mlton.org
Thu Jun 5 13:34:42 PDT 2008


Feature request of John Reppy:

   The MLton.Pointer structure should have
           val sizeofPtr : word
   so that one can allocate arrays of pointers in the C heap.

----------------------------------------------------------------------

U   mlton/trunk/basis-library/mlton/pointer.sig
U   mlton/trunk/basis-library/mlton/pointer.sml

----------------------------------------------------------------------

Modified: mlton/trunk/basis-library/mlton/pointer.sig
===================================================================
--- mlton/trunk/basis-library/mlton/pointer.sig	2008-06-05 19:39:00 UTC (rev 6643)
+++ mlton/trunk/basis-library/mlton/pointer.sig	2008-06-05 20:34:40 UTC (rev 6644)
@@ -36,5 +36,6 @@
       val setWord16: t * int * Word16.word -> unit
       val setWord32: t * int * Word32.word -> unit
       val setWord64: t * int * Word64.word -> unit
+      val sizeofPointer: word
       val sub: t * word -> t
    end

Modified: mlton/trunk/basis-library/mlton/pointer.sml
===================================================================
--- mlton/trunk/basis-library/mlton/pointer.sml	2008-06-05 19:39:00 UTC (rev 6643)
+++ mlton/trunk/basis-library/mlton/pointer.sml	2008-06-05 20:34:40 UTC (rev 6644)
@@ -10,6 +10,8 @@
 
 open Primitive.MLton.Pointer
 
+val sizeofPointer = Word.div (Word.fromInt C_Size.wordSize, 0w8)
+
 val add = fn (p, t) => add (p, C_Size.fromWord t)
 val sub = fn (p, t) => sub (p, C_Size.fromWord t)
 val diff = fn (p, p') => C_Size.toWord (diff (p, p'))




More information about the MLton-commit mailing list