Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/system/Basis/Implementation/Target32Bit/pointer.sml
ViewVC logotype

View of /sml/trunk/system/Basis/Implementation/Target32Bit/pointer.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5627 - (download) (annotate)
Tue Sep 3 13:34:28 2019 UTC (6 weeks, 5 days ago) by jhr
File size: 904 byte(s)
working on 64-bit port
(* pointer.sml
 *
 * COPYRIGHT (c) 2019 The Fellowship of SML/NJ (http://www.smlnj.org)
 * All rights reserved.
 *
 * Implementation of raw runtime-system pointers for 32-bit targets.
 *)

structure PointerImp =
  struct

    structure AddrWord = Word32Imp

    type c_pointer = InlineT.Pointer.t

    val sizeofPointer = 0w4

    val fromWord = InlineT.Pointer.fromWord32

  (* convert a pointer to its bit representation *)
    val toWord = InlineT.Pointer.toWord32

  (* convert a pointer to its bit representation in the LargeWord type *)
    val toLargeWord = AddrWord.toLarge o InlineT.Pointer.toWord32

  (* compare two pointers *)
    fun compare (p, q) = if (p = q) then EQUAL
	  else if (InlineT.Pointer.toWord32 p < InlineT.Pointer.toWord32 q) then LESS
	  else GREATER

  (* return hash value *)
    fun hash cp = InlineT.Word.fromWord32(AddrWord.>>(InlineT.Pointer.toWord32 cp, 0w2))

  end

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