[avahi] arm memory alignment problems

pHilipp Zabel philipp.zabel at gmail.com
Fri Sep 23 07:13:17 PDT 2005


On 9/23/05, Lennart Poettering <lennart at poettering.de> wrote:
> No, this is bogus. If you write the bytes one-by-one to the memory you
> should not call htonl() first. In addition I am wondering why the
> compiler doesn't complain about the fact that you assign an uint32_t
> to an uint8_t variable.

That means my whole patch is bogus :(

> Unless I mixed up LE with BE, this should do it:
>
> d[0] = (uint8_t) (v >> 24);
> d[1] = (uint8_t) (v >> 16);
> d[2] = (uint8_t) (v >> 8);
> d[3] = (uint8_t) v;

This is fine for the append functions, but the consume functions have
to emit host byte order. This would mean different code for different
architectures, wouldn't it?

--
Philipp


More information about the avahi mailing list