diff options
author | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-05-08 01:23:44 +0000 |
---|---|---|
committer | Thomas Fitzsimmons <fitzsim@redhat.com> | 2002-05-08 01:23:44 +0000 |
commit | 60b2107cfda24875c6feb8dadfaec1a7e4bfb645 (patch) | |
tree | 47c762c2ad19b7e464571f81ec9269f0240f8ee2 /newlib/libc/machine/powerpc/vfscanf.c | |
parent | e71372faea4af670215b087a69c2b7432181a852 (diff) | |
download | cygnal-60b2107cfda24875c6feb8dadfaec1a7e4bfb645.tar.gz cygnal-60b2107cfda24875c6feb8dadfaec1a7e4bfb645.tar.bz2 cygnal-60b2107cfda24875c6feb8dadfaec1a7e4bfb645.zip |
* libc/machine/powerpc/vfprintf.c[__ALTIVEC__]: Add vector
support for 'p' format. Fix code to print bytes for vector
integer formats that do not specify 'h' or 'l'.
* libc/machine/powerpc/vfscanf.c[__ALTIVEC__]: Add vector support
for 'p' specifier. Fix code to scan 16 bytes for vector integer
formats that do not specify 'h' or 'l'.
Diffstat (limited to 'newlib/libc/machine/powerpc/vfscanf.c')
-rw-r--r-- | newlib/libc/machine/powerpc/vfscanf.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index b2ea57274..c0bd0e526 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -370,7 +370,11 @@ __svfscanf_r (rptr, fp, fmt0, ap) flags |= LONGDBL; } else - flags |= LONG; + { + flags |= LONG; + if (flags & VECTOR) + vec_read_count = 4; + } goto again; case 'L': flags |= LONGDBL; @@ -384,7 +388,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) #ifdef __ALTIVEC__ case 'v': flags |= VECTOR; - vec_read_count = (flags & SHORT) ? 8 : 4; + vec_read_count = (flags & SHORT) ? 8 : ((flags & LONG) ? 4 : 16); goto again; #endif case '0': @@ -485,7 +489,6 @@ __svfscanf_r (rptr, fp, fmt0, ap) case 'p': /* pointer format is like hex */ flags |= POINTER | PFXOK; - flags &= ~VECTOR; type = CT_INT; ccfn = _strtoul_r; base = 16; @@ -918,7 +921,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) *p = 0; res = (*ccfn) (rptr, buf, (char **) NULL, base); - if (flags & POINTER) + if ((flags & POINTER) && !(flags & VECTOR)) *(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res; else if (flags & SHORT) { @@ -951,10 +954,16 @@ __svfscanf_r (rptr, fp, fmt0, ap) else { if (!(flags & VECTOR)) - ip = va_arg (ap, int *); - else if (!looped) - ip = vec_buf.i; - *ip++ = res; + { + ip = va_arg (ap, int *); + *ip++ = res; + } + else + { + if (!looped) + ch_dest = vec_buf.c; + *ch_dest++ = (char)res; + } } if (!(flags & VECTOR)) nassigned++; |