[sane-devel] hp5400_internal.c rintf()

Martijn van Oosterhout Martijn van Oosterhout <kleptog@svana.org>
Wed, 30 Apr 2003 14:29:51 +1000


--orO6xySwJI16pVnm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Apr 29, 2003 at 08:06:58PM -0400, der Mouse wrote:
> I suspect you really mean be32toh() - but note that I haven't read the
> code in its full context.  If you do, and you're using htonl() for the
> sake of compatability with systems that don't have be32toh() and
> compatriots, then (a) it doesn't much matter whether you use ntohl or
> htonl, since neither one is what you really mean and both perform the
> same function, and (b) I'd recommend using be32toh() in the code and
> defining it as htonl() in a compatability header as needed.

Heh, yeah. There is no difference betwen htonl and ntohl. The problem is
that the data on the wire in in the opposite order on the host data, so it
needs to be reversed. As has been pointed out earlier, all the functions
should be changed to load the bytes individually. Cause, any architechure of
opposite endian will only get it half right because not all fields are
reversed.

be32toh() would be an alternative, but it's not defined on any of my
systems. Long term we need the full solution anyway.

--=20
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "the West won the world not by the superiority of its ideas or values or
> religion but rather by its superiority in applying organized violence.
> Westerners often forget this fact, non-Westerners never do."
>   - Samuel P. Huntington

--orO6xySwJI16pVnm
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE+r1E/Y5Twig3Ge+YRAmVkAJ9pOr80fCyyP+aE/9xcHZqXnhDDuQCcCF8y
D9pgRzeCHt0hYaGziS/pX6c=
=hhSD
-----END PGP SIGNATURE-----

--orO6xySwJI16pVnm--