File:  [Research Unix] / researchv10no / cmd / sml / src / mips / mipsreal.sml
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:34 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

(* Copyright 1989 by AT&T Bell Laboratories *)
functor MipsReal(E: sig val emit_word : int * int -> unit end) : REALCONST = 
struct
    open E
    val halfwords = ref nil : int list ref		(* halfwords already out *)
    val count = ref 0				(* length of halfwords *)
    fun reset_state () = (halfwords := nil; count := 0)
    fun add_half h = (count := !count + 1; halfwords := h :: (!halfwords))

    fun emit_four [lowest,low,high,highest] = 
    			(emit_word(low,lowest);emit_word(highest,high))
      | emit_four _ = ErrorMsg.impossible "bad floating pt constant in mips"

    fun emit_half h = 
        if !count = 3 then (emit_four (h::(!halfwords)); reset_state())
        else add_half h

    structure IEEERealConst =
	RealConst(IEEEReal(struct val emitWord = emit_half end))
    val realconst = IEEERealConst.realconst
end





unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.