home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19318 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.6 KB

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