Article View: net.lang.c
Article #9522Re: Re: structure alignment question
From: Thomas H{meenaho
Date: Wed, 08 Oct 1986 10:13
Date: Wed, 08 Oct 1986 10:13
34 lines
1796 bytes
1796 bytes
In article <7479@sun.uucp> guy@sun.uucp (Guy Harris) writes:
>> The last 68000 compiler I used aligned strings on WORD boundaries.
>> This would cost one byte per string, half the time. But there was a
>> big speed payoff: I could do word operations in my strnlen, strncmp,
>> strncpy, and whatever other string processing functions I happened to
>> write.
>
> char string3[128+1];
>
> strcpy(string3, string1);
>
>would, if it copied a word at a time, have to deal both with words of the
>form
>
> 00xx
>
>(when it recognizes a word of that form, it should stop *before* copying it
>and stuff a zero byte at the end of the target) and of the form
>
> xx00
>
>(when it recognizes a word of that form, it should stop *after* copying it).
>
In sysV for the 68K this technique is used for bcopy inside the kernel.
bcopy is easier as one knows how many bytes are to be moved.
bzero is even smarter, it clears a set of registers and uses movem to copy
them to memory.
--
Thomas Hameenaho, Dept. of Computer Science, Uppsala University, Sweden
Phone: +46 18 138650
UUCP: thomas@kuling.UUCP (...!{seismo,mcvax}!enea!kuling!thomas)
Technical Details
Message-ID:
<1023@kuling.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!enea!kuling!thomasReferences:
<101@hcx1.UUCP> <7363@sun.uucp> <696@mips.UUCP> <7447@sun.uucp> <1705@mcc-pp.UUCP> <7479@sun.uucp>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!mcvax!enea!kuling!thomas
From: thomas@kuling.UUCP (Thomas H{meenaho)
Newsgroups: net.lang.c
Subject: Re: Re: structure alignment question
Message-ID: <1023@kuling.UUCP>
Date: Wed, 8-Oct-86 06:13:10 EDT
Article-I.D.: kuling.1023
Posted: Wed Oct 8 06:13:10 1986
Date-Received: Thu, 9-Oct-86 06:09:26 EDT
References: <101@hcx1.UUCP> <7363@sun.uucp> <696@mips.UUCP> <7447@sun.uucp> <1705@mcc-pp.UUCP> <7479@sun.uucp>
Reply-To: thomas@kuling.UUCP (Thomas H{meenaho)
Organization: Dep. of Computer Systems, Upsala University, Sweden
Lines: 34