From: Dan.Pop@cern.ch (Dan Pop)
Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA *
Date: 1998/09/09 [thread overview]
Message-ID: <danpop.905351770@news.cern.ch> (raw)
In-Reply-To: 6t4h4d$mo4$1@nntp.ucs.ubc.ca
In <6t4h4d$mo4$1@nntp.ucs.ubc.ca> shoppa@alph02.triumf.ca (Tim Shoppa) writes:
>Are you sure you want to say that? I'd call them a feature of the
>PDP-11 instruction set before I called them a feature of MACRO-11, but
...
>For example, if in PDP-11 assembler I want to move a string
>pointed to by R2 to an area pointed to by R3, I just say:
>
>LOOP: MOVB (R2)+,(R3)+
> BNE LOOP
In other words, the PDP-11 instruction set does NOT contain *any*
instruction for C string manipulation, you have to do that with
programmed loops, just as you'd do it on any other processor. Using your
logic, this is a feature of any processor's instruction set.
>If I tried to do this any other way - say by prepending the string length,
>or by appending a FF or a '$' - the code gets longer
Again, testing against zero takes fewer bytes on many instruction sets.
>(though not necessarily slower...)
If the operation is not copying the string but something needing the
length of the string (e.g. strlen() or strcat()), prepending the string
length is provably faster. Try to implement strlen() for Pascal-style
strings in PDP-11 assembler and you'll discover that Pascal-style
strings are a feature of the PDP-11 instruction set :-) It takes exactly
one instruction, besides the RET (RTS R6). The same thing for C strings
(optimized for instruction count) would be something like:
MOV -1,R0
LOOP: INC R0
TSTB (R2)+
BNE LOOP
Dan
--
Dan Pop
CERN, IT Division
Email: Dan.Pop@cern.ch
Mail: CERN - EP, Bat. 31 1-014, CH-1211 Geneve 23, Switzerland
next prev parent reply other threads:[~1998-09-09 4:00 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0095000017115526000002L062*@MHS>
[not found] ` <35E04DF1.1911@world.std.com>
[not found] ` <35E09E76.6773@earthlink.net>
1998-08-23 4:00 ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Terry C. Shannon
1998-08-23 4:00 ` Glenn C. Everhart
1998-08-24 4:00 ` Paul Sture
1998-08-25 4:00 ` Gregg E Economou
1998-08-25 4:00 ` Jordan Henderson
1998-08-26 4:00 ` Bob Koehler
[not found] ` <6s910k$2bo$1@Starbase.NeoSoft.COM>
1998-08-29 4:00 ` Gregg E Economou
1998-08-30 4:00 ` Jay Maynard
[not found] ` <35e833be.0@news.wizvax.net>
1998-08-29 4:00 ` Jordan Henderson
1998-08-30 4:00 ` John Wilson
1998-08-30 4:00 ` JF Mezei
1998-08-30 4:00 ` Chris Torek
1998-08-31 4:00 ` Gregg E Economou
1998-08-31 4:00 ` Chris Torek
1998-08-30 4:00 ` Lawrence Kirby
1998-08-30 4:00 ` JF Mezei
1998-08-30 4:00 ` Martin Ambuhl
1998-08-31 4:00 ` Michael Rubenstein
[not found] ` <6scur7$qtk@bgtnsc02.wo <35EA0E22.C59E9476@videotron.ca>
1998-08-31 4:00 ` Will Rose
1998-08-31 4:00 ` Craig Franck
1998-08-30 4:00 ` JF Mezei
1998-08-31 4:00 ` firewind
1998-09-04 4:00 ` Thor Lancelot Simon
1998-08-30 4:00 ` Gregg E Economou
1998-08-30 4:00 ` K&R fight over ketchup (was: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA ) Clint Comes
1998-08-31 4:00 ` Bob Koehler
1998-09-05 4:00 ` Gregg E Economou
1998-09-05 4:00 ` Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Peter da Silva
1998-09-05 4:00 ` Jordan Henderson
1998-09-07 4:00 ` Peter da Silva
1998-09-07 4:00 ` Jordan Henderson
1998-09-07 4:00 ` Dan Pop
1998-09-07 4:00 ` Richard Stamp
1998-09-07 4:00 ` Peter da Silva
1998-09-07 4:00 ` Jordan Henderson
1998-09-08 4:00 ` Tim Shoppa
[not found] ` <6t4cui$hfu@espresso.cafe.net>
1998-09-09 4:00 ` Tim Shoppa
1998-09-08 4:00 ` JF Mezei
1998-09-09 4:00 ` Dan Pop [this message]
1998-09-09 4:00 ` Peter da Silva
1998-09-08 4:00 ` Peter da Silva
[not found] ` <6t2im5$mke@espresso.cafe.net>
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` JF Mezei
1998-09-08 4:00 ` Dan Pop
1998-09-08 4:00 ` Peter da Silva
1998-09-08 4:00 ` Dan Pop
1998-08-25 4:00 ` John Wilson
1998-08-26 4:00 ` Gregg E Economou
1998-08-27 4:00 ` John Wilson
1998-08-26 4:00 ` Bob Koehler
1998-08-27 4:00 ` Peter da Silva
1998-08-31 4:00 ` Boris
1998-08-27 4:00 ` Thor Lancelot Simon
1998-08-28 4:00 ` Bob Koehler
1998-09-05 4:00 ` Peter da Silva
1998-09-08 4:00 ` Carl Perkins
1998-08-28 4:00 ` TERENCE MURPHY
1998-08-28 4:00 ` George Cornelius
1998-08-28 4:00 ` Greg Thomas
1998-08-29 4:00 ` mathog
1998-09-01 4:00 ` Greg Thomas
1998-08-28 4:00 ` Monty Brandenberg
1998-08-29 4:00 ` Gregg E Economou
1998-09-05 4:00 ` Peter da Silva
1998-08-31 4:00 ` Boris
1998-08-26 4:00 ` Paul Sture
1998-08-27 4:00 ` Gregg E Economou
1998-08-28 4:00 ` Paul Sture
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox