Merge remote branch 'nsz/master'
authorRich Felker <dalias@aerifal.cx>
Sat, 17 Mar 2012 01:01:34 +0000 (21:01 -0400)
committerRich Felker <dalias@aerifal.cx>
Sat, 17 Mar 2012 01:01:34 +0000 (21:01 -0400)
COPYRIGHT
src/math/i386/sqrt.s
src/math/i386/sqrtf.s
src/stdio/__scanf.c

index 814cabd..730e04a 100644 (file)
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -37,7 +37,7 @@ The x86_64 port was written by Nicholas J. Kain. See individual files
 for their copyright status.
 
 All files which have no copyright comments are original works
-Copyright © 2005-2011 Rich Felker, the main author of this library.
+Copyright © 2005-2012 Rich Felker, the main author of this library.
 The decision to exclude such comments is intentional, as it should be
 possible to carry around the complete source code on tiny storage
 media. All public header files (include/*) should be treated as Public
index c6e5530..8289d09 100644 (file)
@@ -2,4 +2,20 @@
 .type sqrt,@function
 sqrt:  fldl 4(%esp)
        fsqrt
+       fstsw %ax
+       sub $12,%esp
+       fld %st(0)
+       fstpt (%esp)
+       mov (%esp),%ecx
+       and $0x7ff,%ecx
+       cmp $0x400,%ecx
+       jnz 1f
+       and $0x200,%eax
+       sub $0x100,%eax
+       sub %eax,(%esp)
+       fstp %st(0)
+       fldt (%esp)
+1:     add $12,%esp
+       fstpl 4(%esp)
+       fldl 4(%esp)
        ret
index b79bd94..9e944f4 100644 (file)
@@ -2,4 +2,6 @@
 .type sqrtf,@function
 sqrtf: flds 4(%esp)
        fsqrt
+       fstps 4(%esp)
+       flds 4(%esp)
        ret
index 062327d..7c82cca 100644 (file)
@@ -319,34 +319,29 @@ int __scanf(rctx_t *r, const wchar_t *fmt, va_list ap)
                                        unread(r);
                                        break;
                                }
+                               m = 1;
                                if (((c=read(r))|0x20) != 'x') {
-                                       if (t == 'i') {
-                                               t = 'o';
-                                               /* lone 0 is valid octal */
-                                               if ((unsigned)(c-'0') >= 8) {
-                                                       m = 1;
-                                                       goto int_finish;
-                                               }
-                                       }
+                                       if (t == 'i') t = 'o';
                                        unread(r);
                                        break;
                                }
                                t = 'x';
+                               m = 0;
                        }
                }
                
                switch (t) {
                case 'd':
                case 'u':
-                       for (m=0; isdigit(c=read(r)); m=1)
+                       for (; isdigit(c=read(r)); m=1)
                                i = 10*i + c-'0';
                        goto int_finish;
                case 'o':
-                       for (m=0; (unsigned)(c=read(r))-'0' < 8; m=1)
+                       for (; (unsigned)(c=read(r))-'0' < 8; m=1)
                                i = (i<<3) + c-'0';
                        goto int_finish;
                case 'x':
-                       for (m=0; ; m=1) {
+                       for (; ; m=1) {
                                if (isdigit(c=read(r))) {
                                        i = (i<<4) + c-'0';
                                } else if ((unsigned)(c|0x20)-'a' < 6) {