Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: structure alignment question Message-ID: <86900062@haddock> Date: Mon, 22-Sep-86 09:15:00 EDT Article-I.D.: haddock.86900062 Posted: Mon Sep 22 09:15:00 1986 Date-Received: Mon, 22-Sep-86 21:37:32 EDT References: <5500003@hcx1> Lines: 18 Nf-ID: #R:hcx1:5500003:haddock:86900062:000:881 Nf-From: haddock!karl Sep 22 09:15:00 1986 >In article <1705@mcc-pp.UUCP> tiemann@mcc-pp.UUCP (Michael Tiemann) writes: >>The last 68000 compiler I used aligned strings on WORD boundaries. ... >>There was a big speed payoff: I could do word operations in [strncpy, etc.] Wrong! Even if strings are word-aligned, substrings (e.g. "p+1") will not be. (Unless the chars themselves are word-aligned, in which case your space penalty is a factor of two instead of a half byte.) umcp-cs!chris (Chris Torek) writes: >It is not difficult to do copies in word mode iff the strings are aligned: >[example of a strcpy() that considers four alignment cases] Even if the strings are word-aligned, you have to test for a null *byte* (not a zero word); my guess is that the extra manipulation inside the loop will make it slower than a byte-by-byte copy. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint