[sane-devel] hp5400_internal.c rintf()
Martijn van Oosterhout
kleptog at svana.org
Wed Apr 30 05:29:51 BST 2003
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.
--
Martijn van Oosterhout <kleptog at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/sane-devel/attachments/20030430/e399cc0d/attachment.sig>
More information about the sane-devel
mailing list