[MLton-devel] Int-inf shifts

Stephen Weeks MLton@mlton.org
Thu, 31 Oct 2002 18:12:28 -0800


> How did the optimizer ignore the base?

It didn't even look at it.

% cvs diff -r 1.36 -r 1.37 prim.fun
Index: prim.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/atoms/prim.fun,v
retrieving revision 1.36
retrieving revision 1.37
diff -c -r1.36 -r1.37
*** prim.fun	25 Aug 2002 22:23:57 -0000	1.36
--- prim.fun	1 Nov 2002 01:25:34 -0000	1.37
***************
*** 1115,1122 ****
  	 in
  	    case (name, args) of
  	       (IntInf_neg, [Const (IntInf i), _]) => intInf (IntInf.~ i)
! 	     | (IntInf_toString, [Const (IntInf i), _, _]) =>
! 		  string (IntInf.toString i)
  	     | (_, [Con {con = c, hasArg = h}, Con {con = c', hasArg = h'}]) =>
  		  if name = MLton_equal orelse name = MLton_eq
  		     then if Con.equals (c, c')
--- 1115,1132 ----
  	 in
  	    case (name, args) of
  	       (IntInf_neg, [Const (IntInf i), _]) => intInf (IntInf.~ i)
! 	     | (IntInf_toString, [Const (IntInf i), Const (Int base), _]) =>
! 		  let
! 		     val base =
! 			case base of
! 			   2 => StringCvt.BIN
! 			 | 8 => StringCvt.OCT 
! 			 | 10 => StringCvt.DEC
! 			 | 16 => StringCvt.HEX
! 			 | _ => Error.bug "strange base for IntInf_toString"
! 		  in
! 		     string (IntInf.format (i, base))
! 		  end
  	     | (_, [Con {con = c, hasArg = h}, Con {con = c', hasArg = h'}]) =>
  		  if name = MLton_equal orelse name = MLton_eq
  		     then if Con.equals (c, c')




-------------------------------------------------------
This sf.net email is sponsored by: Influence the future 
of Java(TM) technology. Join the Java Community 
Process(SM) (JCP(SM)) program now. 
http://ads.sourceforge.net/cgi-bin/redirect.pl?sunm0004en
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel