On Sunday 01 January 2006 14:30, Frank Zago wrote:
> >+#if defined(WORDS_BIGENDIAN)
> > for (p = buf; p < buf + nread; p++)
> > {
> > b = *p;
> > *p++ = *(p + 1);
> > *p = b;
> > }
> >+#endif
> > }
>
> Why not use htons() which should be a little more efficient?Please note that the patch only adds the #if so that in some cases, the swap code is not run at all. If you change that code, maybe adding something like nread&=~1 before the actual reading would be nice too.
