[MLton-devel] Int-inf shifts

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Thu, 31 Oct 2002 22:27:53 -0500 (EST)


> The lower case problem is still there.

The simplest fix would seem to be to add the following to IntInf.c in the
IntInf_do_toString function:

[fluet@lennon basis]$ cvs diff IntInf.c
Index: IntInf.c
===================================================================
RCS file: /cvsroot/mlton/mlton/runtime/basis/IntInf.c,v
retrieving revision 1.6.2.2
diff -r1.6.2.2 IntInf.c
356a357,358
>       int             i;
>       char            c;
365a368,372
>         for (i = 0; i < size; i++) {
>               c = sp->chars[i];
>               if (('a' <= c) && (c <= 'z'))
>                       sp->chars[i] = c - ' ';
>       }

While we could do the translation back in ML, that's going to require
another string allocation, so it hardly seems worth it.  If anyone is
worried about speed, we could wrap the for-loop inside an if (base > 10)
condition, so all but hex formatting would not require the extra walk.

I looked through the GMP docs a little bit, and it looks like their printf
formatting would let you select the case of hex digits, but mpz_get_str
doesn't seem to support anything like that.



-------------------------------------------------------
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