X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata-in.c;h=9bdda48cf3113877ee3f4c8c982522df17cac8fb;hb=608859d57ed847296e950d795f3fa7e569f19a60;hp=04c035d4f66fe2eb57f80d0e7ad7e56abb9d8243;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/data-in.c b/src/data-in.c index 04c035d4f6..9bdda48cf3 100644 --- a/src/data-in.c +++ b/src/data-in.c @@ -451,14 +451,13 @@ parse_IB (struct data_in *i) /* We want the data to be in big-endian format. If this is a little-endian machine, reverse the byte order. */ - if (endian == LITTLE) - { - memcpy (buf, i->s, i->e - i->s); - mm_reverse (buf, i->e - i->s); - p = buf; - } - else - p = i->s; +#ifdef WORDS_BIGENDIAN + p = i->s; +#else + memcpy (buf, i->s, i->e - i->s); + mm_reverse (buf, i->e - i->s); + p = buf; +#endif /* If the value is negative, we need to logical-NOT each value before adding it. */ @@ -492,12 +491,13 @@ parse_PIB (struct data_in *i) int j; i->v->f = 0.0; - if (endian == BIG) - for (j = 0; j < i->e - i->s; j++) - i->v->f = i->v->f * 256.0 + i->s[j]; - else - for (j = i->e - i->s - 1; j >= 0; j--) - i->v->f = i->v->f * 256.0 + i->s[j]; +#if WORDS_BIGENDIAN + for (j = 0; j < i->e - i->s; j++) + i->v->f = i->v->f * 256.0 + i->s[j]; +#else + for (j = i->e - i->s - 1; j >= 0; j--) + i->v->f = i->v->f * 256.0 + i->s[j]; +#endif if (i->format.d) i->v->f /= pow (10.0, i->format.d);