Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!inria!mirsa!huitema From: huitema@mirsa.inria.fr (Christian Huitema) Newsgroups: comp.arch Subject: Re: Unaligned Accesses (was Re: How to use silicon) Message-ID: <150@mirsa.inria.fr> Date: 29 Mar 89 15:41:25 GMT References: <844@bnr-rsc.UUCP> Organization: INRIA, Sophia Antipolis. France Lines: 18 From experience, I can say that not having to bother with alignment can make networking code much faster. Messages exchanged over nets include all sort of variable size components, and padding is both frowned upon and somewhat ineffective -- often, one cannot predict where a structure will start. Thus, being able to simply define: #define integer_value(mess,x) (*(int *)(mess + x)) rather than: #define integer_value(mess,x) \ (((((mess[x]<<8)|mess[x+1])<<8)|mess[x+2]<<8)|mess[x+3]) can speed up a lot the decoding of these messages. Indeed, one can object the relative frequency of network operations vs computing, but the same holds for compression programs, disk accesses, etc... Christian Huitema