[sane-devel] sane-canon: Endian inverted data when scanning 48bbp raw mode pnm, little endian architectures only

Jean-Michel Vourgère contact_mlsane at nirgal.com
Mon Jan 2 10:34:16 UTC 2006


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.



More information about the sane-devel mailing list