home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!heimdall!thor!scjones
- From: scjones@thor.sdrc.com (Larry Jones)
- Newsgroups: comp.lang.c
- Subject: Re: Problem with string processing.
- Message-ID: <288@heimdall.sdrc.com>
- Date: 6 Jan 93 17:43:26 GMT
- References: <1993Jan4.022737.19792@kpc.com> <2mqVwB6w165w@cybrspc.UUCP> <811@ulogic.UUCP>
- Sender: news@heimdall.sdrc.com
- Distribution: usa
- Lines: 23
-
- In article <811@ulogic.UUCP>, hartman@ulogic.UUCP (Richard M. Hartman) writes:
- > If there were a decent way of getting the string length w/o
- > counting all the bytes then direct support for strcpy() could
- > be done easily. Are there any CPUs that have a single-instruction
- > way of saying "find the next 0 byte & tell me how far it was from here"?
-
- Of course -- everyone's favorite example of a CISC machine, the good
- old DEC Vax has the Locate Character (LOCC) instruction that locates
- the next occurrence of any single character (as well as a whole bunch
- of other character manipulation instructions); the Intel x86 family has
- the Scan String (SCAS) instruction which can do the same thing; and
- even the venerable IBM 360/370 family of CPUs have a Translate and Test
- (TRT) instruction that locates the next occurrence of an character from
- a set.
-
- Of course, it's not clear that any of these instructions are actually
- faster than the equivalent loop of primitive instructions and a good bit
- of historical precedent indicates that they are probably slower.
- ----
- Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
- larry.jones@sdrc.com or ...uunet!sdrc!larry.jones
- Why can't I ever build character in a Miami condo or a casino somewhere?
- -- Calvin
-