[Bro-Dev] Alignment check in RPC code

Robin Sommer robin at icir.org
Sat Dec 11 08:59:22 PST 2010


Gregor wrote:

> Mac OS X is fine with doing un-aligned reads.

This surprises me. Isn't that a CPU property rather than a OS property?

Vern wrote:

> I don't think it's prudent to throw out this check.

Ack. 

> 	uint32 bits32 = XDR_aligned(buf) ? ntohl(*(uint32*) buf) :
> 		((buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]);

I'm wondering how much benefit we get by doing this if-else clause
vs. just always doing the safe version that doesn't care about
alignment? Is it worth it?

Robin

-- 
Robin Sommer * Phone +1 (510) 722-6541 * robin at icir.org
ICSI/LBNL    * Fax   +1 (510) 666-2956 *   www.icir.org


More information about the bro-dev mailing list