|
|
1.1 ! root 1: (* Copyright 1989 by AT&T Bell Laboratories *) ! 2: functor MipsReal(E: sig val emit_word : int * int -> unit end) : REALCONST = ! 3: struct ! 4: open E ! 5: val halfwords = ref nil : int list ref (* halfwords already out *) ! 6: val count = ref 0 (* length of halfwords *) ! 7: fun reset_state () = (halfwords := nil; count := 0) ! 8: fun add_half h = (count := !count + 1; halfwords := h :: (!halfwords)) ! 9: ! 10: fun emit_four [lowest,low,high,highest] = ! 11: (emit_word(low,lowest);emit_word(highest,high)) ! 12: | emit_four _ = ErrorMsg.impossible "bad floating pt constant in mips" ! 13: ! 14: fun emit_half h = ! 15: if !count = 3 then (emit_four (h::(!halfwords)); reset_state()) ! 16: else add_half h ! 17: ! 18: structure IEEERealConst = ! 19: RealConst(IEEEReal(struct val emitWord = emit_half end)) ! 20: val realconst = IEEERealConst.realconst ! 21: end ! 22: ! 23: ! 24: ! 25:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.