TIP: Click on subject to list as thread! ANSI
echo: public_domain
to: Matthew Parker
from: Paul Edwards
date: 1995-12-27 12:56:26
subject: movsb

Hi Matthew.  I have the following code...

#include 

int main(void)
{
    register char *t = NULL;
    register char *u = NULL;
    
    while ((*t++ = *u++) != '\n') ; /* This is the only line of interest */
    
    if (*t == 37) printf("hello\n");
    return (0);
}

Which produces various assembler on my various compilers, but it
is fairly similar, along the lines...

 002c  8a 01             L2              mov     al,[ecx]
 002e  88 02                             mov     [edx],al
 0030  41                                inc     ecx
 0031  42                                inc     edx
 0032  3c 0a                             cmp     al,0aH
 0034  75 f6                             jne     L2


This code is what will be the bottleneck in any text processing
applications using fgets() with PDPCLIB, and I was thinking it
might be possible/better to use some assembler here, to use a
MOVSB or something.  If the average length of a text line that is
processed by fgets is say 30 bytes, then this loop will be 
executed 30 times.

I was wondering if you had any feel for what would be best
time-wise.  This code is a C runtime library for OS/2 32-bit
80386 and above.  The C runtime library, being of dire
importance, can be as dirty as you can make it, so long as it's
FAST FAST FAST!  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.