Newsgroups: comp.arch Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Is handling off-alignment important? (was Re: RISC hard to program?) Message-ID: <1990Jul18.190750.7282@zoo.toronto.edu> Organization: U of Toronto Zoology References: <40088@mips.mips.COM> <2162@opus.cs.mcgill.ca> <3648@auspex.auspex.com> <2163@opus.cs.mcgill.ca> <104037@convex.convex.com> Date: Wed, 18 Jul 90 19:07:50 GMT In article <104037@convex.convex.com> patrick@convex.com (Patrick F. McGehearty) writes: >Trivial example: consider the std libc bcopy which takes two pointers and a >count. Most machine specific implementations move the data in units larger >than a character at time. Under what conditions should the implementor of >this commonly used library worry about checking the alignment of the >pointers before starting the copy? Essentially always, unless the count is very small. Even on machines that handle misalignment, if the alignment on the two areas is compatible, it is better to copy enough initial bytes to align the pointers and then do an aligned copy for the bulk of the data. (Also, a quibble: bcopy may be "std", but the *standard* routine for doing this is memcpy. :-)) -- NFS: all the nice semantics of MSDOS, | Henry Spencer at U of Toronto Zoology and its performance and security too. | henry@zoo.toronto.edu utzoo!henry