[Bro-Dev] Alignment check in RPC code

Vern Paxson vern at icir.org
Sat Dec 11 09:09:11 PST 2010


> > 	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?

Good point.  Chucking the optimized version and just going with the second
line is the way to go.

		Vern


More information about the bro-dev mailing list