瀏覽代碼

* use strlenint instead of longint

peter 21 年之前
父節點
當前提交
d12b3ae991
共有 4 個文件被更改,包括 78 次插入66 次删除
  1. 15 12
      rtl/inc/strings.pp
  2. 6 3
      rtl/inc/stringsi.inc
  3. 30 27
      rtl/x86_64/strings.inc
  4. 27 24
      rtl/x86_64/strlen.inc

+ 15 - 12
rtl/inc/strings.pp

@@ -18,7 +18,7 @@ unit strings;
 interface
 interface
 
 
     { Returns the length of a string }
     { Returns the length of a string }
-    function strlen(p : pchar) : longint;
+    function strlen(p : pchar) : strlenint;
 
 
     { Converts a Pascal string to a null-terminated string }
     { Converts a Pascal string to a null-terminated string }
     function strpcopy(d : pchar;const s : string) : pchar;
     function strpcopy(d : pchar;const s : string) : pchar;
@@ -31,7 +31,7 @@ interface
 
 
     { Copies at most maxlen bytes from source to dest. }
     { Copies at most maxlen bytes from source to dest. }
     { Returns a pointer to dest }
     { Returns a pointer to dest }
-    function strlcopy(dest,source : pchar;maxlen : longint) : pchar;
+    function strlcopy(dest,source : pchar;maxlen : strlenint) : pchar;
 
 
     { Copies source to dest and returns a pointer to the terminating }
     { Copies source to dest and returns a pointer to the terminating }
     { null character.    }
     { null character.    }
@@ -47,19 +47,19 @@ interface
     { a value <0 if str1<str2;        }
     { a value <0 if str1<str2;        }
     {  0 when str1=str2               }
     {  0 when str1=str2               }
     { and a value >0 if str1>str2     }
     { and a value >0 if str1>str2     }
-    function strcomp(str1,str2 : pchar) : longint;
+    function strcomp(str1,str2 : pchar) : strlenint;
 
 
     { The same as strcomp, but at most l characters are compared  }
     { The same as strcomp, but at most l characters are compared  }
-    function strlcomp(str1,str2 : pchar;l : longint) : longint;
+    function strlcomp(str1,str2 : pchar;l : strlenint) : strlenint;
 
 
     { The same as strcomp but case insensitive       }
     { The same as strcomp but case insensitive       }
-    function stricomp(str1,str2 : pchar) : longint;
+    function stricomp(str1,str2 : pchar) : strlenint;
 
 
     { Copies l characters from source to dest, returns dest. }
     { Copies l characters from source to dest, returns dest. }
-    function strmove(dest,source : pchar;l : longint) : pchar;
+    function strmove(dest,source : pchar;l : strlenint) : pchar;
 
 
     { Appends at most l characters from source to dest }
     { Appends at most l characters from source to dest }
-    function strlcat(dest,source : pchar;l : longint) : pchar;
+    function strlcat(dest,source : pchar;l : strlenint) : pchar;
 
 
     { Returns a pointer to the first occurrence of c in p }
     { Returns a pointer to the first occurrence of c in p }
     { If c doesn't occur, nil is returned }
     { If c doesn't occur, nil is returned }
@@ -76,7 +76,7 @@ interface
     function strupper(p : pchar) : pchar;
     function strupper(p : pchar) : pchar;
 
 
     { The same al stricomp, but at most l characters are compared }
     { The same al stricomp, but at most l characters are compared }
-    function strlicomp(str1,str2 : pchar;l : longint) : longint;
+    function strlicomp(str1,str2 : pchar;l : strlenint) : strlenint;
 
 
     { Returns a pointer to the first occurrence of str2 in    }
     { Returns a pointer to the first occurrence of str2 in    }
     { str2 Otherwise returns nil                          }
     { str2 Otherwise returns nil                          }
@@ -86,7 +86,7 @@ interface
     function strnew(p : pchar) : pchar;
     function strnew(p : pchar) : pchar;
 
 
     { Allocates L bytes on the heap, returns a pchar pointer to it }
     { Allocates L bytes on the heap, returns a pchar pointer to it }
-    function stralloc(L : longint) : pchar;
+    function stralloc(L : strlenint) : pchar;
 
 
     { Releases a null-terminated string from the heap  }
     { Releases a null-terminated string from the heap  }
     procedure strdispose(p : pchar);
     procedure strdispose(p : pchar);
@@ -108,7 +108,7 @@ implementation
 
 
 { Functions, different from the one in sysutils }
 { Functions, different from the one in sysutils }
 
 
-    function stralloc(L : longint) : pchar;
+    function stralloc(L : strlenint) : pchar;
 
 
       begin
       begin
          StrAlloc:=Nil;
          StrAlloc:=Nil;
@@ -118,7 +118,7 @@ implementation
     function strnew(p : pchar) : pchar;
     function strnew(p : pchar) : pchar;
 
 
       var
       var
-         len : longint;
+         len : strlenint;
 
 
       begin
       begin
          strnew:=nil;
          strnew:=nil;
@@ -144,7 +144,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2003-07-07 20:22:05  peter
+  Revision 1.6  2004-02-18 22:00:59  peter
+    * use strlenint instead of longint
+
+  Revision 1.5  2003/07/07 20:22:05  peter
     * generic string routines added
     * generic string routines added
 
 
   Revision 1.4  2002/09/07 15:07:46  peter
   Revision 1.4  2002/09/07 15:07:46  peter

+ 6 - 3
rtl/inc/stringsi.inc

@@ -21,7 +21,7 @@
         strcat:=dest;
         strcat:=dest;
       end;
       end;
 
 
-    function strlcat(dest,source : pchar;l : longint) : pchar;
+    function strlcat(dest,source : pchar;l : strlenint) : pchar;
 
 
       var
       var
          destend : pchar;
          destend : pchar;
@@ -34,7 +34,7 @@
          strlcat:=dest;
          strlcat:=dest;
       end;
       end;
 
 
-    function strmove(dest,source : pchar;l : longint) : pchar;
+    function strmove(dest,source : pchar;l : strlenint) : pchar;
 
 
       begin
       begin
          move(source^,dest^,l);
          move(source^,dest^,l);
@@ -66,7 +66,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-12-29 19:24:12  florian
+  Revision 1.5  2004-02-18 22:00:59  peter
+    * use strlenint instead of longint
+
+  Revision 1.4  2003/12/29 19:24:12  florian
     + introduced PtrInt and PtrUInt
     + introduced PtrInt and PtrUInt
     * made strscan 64 bit safe
     * made strscan 64 bit safe
 
 

+ 30 - 27
rtl/x86_64/strings.inc

@@ -17,7 +17,7 @@
  **********************************************************************}
  **********************************************************************}
 
 
 {$define FPC_UNIT_HAS_STRLEN}
 {$define FPC_UNIT_HAS_STRLEN}
-function strlen(p : pchar) : longint;assembler;
+function strlen(p : pchar) : strlenint;assembler;
 {$i strlen.inc}
 {$i strlen.inc}
 
 
 
 
@@ -29,30 +29,30 @@ asm
         andl $7, %ecx                  { mask alignment bits }
         andl $7, %ecx                  { mask alignment bits }
         movq %rdi, %rdx                { Duplicate destination pointer.  }
         movq %rdi, %rdx                { Duplicate destination pointer.  }
 
 
-        jz LFPC_STRCOPY_5              { aligned => start loop }
+        jz .LFPC_STRCOPY_5              { aligned => start loop }
 
 
         neg %ecx                       { We need to align to 8 bytes.  }
         neg %ecx                       { We need to align to 8 bytes.  }
         addl $8,%ecx
         addl $8,%ecx
 
 
         { Search the first bytes directly.  }
         { Search the first bytes directly.  }
-LFPC_STRCOPY_0:
+.LFPC_STRCOPY_0:
         movb        (%rsi), %al        { Fetch a byte }
         movb        (%rsi), %al        { Fetch a byte }
         testb       %al, %al           { Is it NUL? }
         testb       %al, %al           { Is it NUL? }
         movb        %al, (%rdx)        { Store it }
         movb        %al, (%rdx)        { Store it }
-        jz          LFPC_STRCOPY_4     { If it was NUL, done! }
+        jz          .LFPC_STRCOPY_4     { If it was NUL, done! }
         incq        %rsi
         incq        %rsi
         incq        %rdx
         incq        %rdx
         decl        %ecx
         decl        %ecx
-        jnz         LFPC_STRCOPY_0
+        jnz         .LFPC_STRCOPY_0
 
 
-LFPC_STRCOPY_5:
+.LFPC_STRCOPY_5:
         movq        $0xfefefefefefefeff,%r8
         movq        $0xfefefefefefefeff,%r8
 
 
         { Now the sources is aligned.  Unfortunatly we cannot force
         { Now the sources is aligned.  Unfortunatly we cannot force
            to have both source and destination aligned, so ignore the
            to have both source and destination aligned, so ignore the
            alignment of the destination.  }
            alignment of the destination.  }
         .p2align 4
         .p2align 4
-LFPC_STRCOPY_1:
+.LFPC_STRCOPY_1:
         { 1st unroll.  }
         { 1st unroll.  }
         movq        (%rsi), %rax       { Read double word (8 bytes).  }
         movq        (%rsi), %rax       { Read double word (8 bytes).  }
         addq        $8, %rsi           { Adjust pointer for next word.  }
         addq        $8, %rsi           { Adjust pointer for next word.  }
@@ -60,13 +60,13 @@ LFPC_STRCOPY_1:
         addq        %r8, %r9           { add the magic value to the word.  We get
         addq        %r8, %r9           { add the magic value to the word.  We get
                                          carry bits reported for each byte which
                                          carry bits reported for each byte which
                                          is *not* 0 }
                                          is *not* 0 }
-        jnc         LFPC_STRCOPY_3     { highest byte is NUL => return pointer }
+        jnc         .LFPC_STRCOPY_3     { highest byte is NUL => return pointer }
         xorq        %rax, %r9          { (word+magic)^word }
         xorq        %rax, %r9          { (word+magic)^word }
         orq         %r8, %r9           { set all non-carry bits }
         orq         %r8, %r9           { set all non-carry bits }
         incq        %r9                { add 1: if one carry bit was *not* set
         incq        %r9                { add 1: if one carry bit was *not* set
                                          the addition will not result in 0.  }
                                          the addition will not result in 0.  }
 
 
-        jnz         LFPC_STRCOPY_3                { found NUL => return pointer }
+        jnz         .LFPC_STRCOPY_3                { found NUL => return pointer }
 
 
         movq        %rax, (%rdx)        { Write value to destination.  }
         movq        %rax, (%rdx)        { Write value to destination.  }
         addq        $8, %rdx        { Adjust pointer.  }
         addq        $8, %rdx        { Adjust pointer.  }
@@ -78,13 +78,13 @@ LFPC_STRCOPY_1:
         addq        %r8, %r9        { add the magic value to the word.  We get
         addq        %r8, %r9        { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc         LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
+        jnc         .LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
         xorq        %rax, %r9        { (word+magic)^word }
         xorq        %rax, %r9        { (word+magic)^word }
         orq         %r8, %r9        { set all non-carry bits }
         orq         %r8, %r9        { set all non-carry bits }
         incq        %r9                { add 1: if one carry bit was *not* set
         incq        %r9                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
 
 
-        jnz         LFPC_STRCOPY_3                { found NUL => return pointer }
+        jnz         .LFPC_STRCOPY_3                { found NUL => return pointer }
 
 
         movq        %rax, (%rdx)        { Write value to destination.  }
         movq        %rax, (%rdx)        { Write value to destination.  }
         addq        $8, %rdx        { Adjust pointer.  }
         addq        $8, %rdx        { Adjust pointer.  }
@@ -96,13 +96,13 @@ LFPC_STRCOPY_1:
         addq        %r8, %r9        { add the magic value to the word.  We get
         addq        %r8, %r9        { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc        LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
+        jnc        .LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
         xorq        %rax, %r9        { (word+magic)^word }
         xorq        %rax, %r9        { (word+magic)^word }
         orq        %r8, %r9        { set all non-carry bits }
         orq        %r8, %r9        { set all non-carry bits }
         incq        %r9                { add 1: if one carry bit was *not* set
         incq        %r9                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
 
 
-        jnz         LFPC_STRCOPY_3                { found NUL => return pointer }
+        jnz         .LFPC_STRCOPY_3                { found NUL => return pointer }
 
 
         movq        %rax, (%rdx)        { Write value to destination.  }
         movq        %rax, (%rdx)        { Write value to destination.  }
         addq        $8, %rdx        { Adjust pointer.  }
         addq        $8, %rdx        { Adjust pointer.  }
@@ -114,36 +114,36 @@ LFPC_STRCOPY_1:
         addq        %r8, %r9        { add the magic value to the word.  We get
         addq        %r8, %r9        { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc         LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
+        jnc         .LFPC_STRCOPY_3                { highest byte is NUL => return pointer }
         xorq        %rax, %r9        { (word+magic)^word }
         xorq        %rax, %r9        { (word+magic)^word }
         orq         %r8, %r9        { set all non-carry bits }
         orq         %r8, %r9        { set all non-carry bits }
         incq        %r9                { add 1: if one carry bit was *not* set
         incq        %r9                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
 
 
-        jnz         LFPC_STRCOPY_3                { found NUL => return pointer }
+        jnz         .LFPC_STRCOPY_3                { found NUL => return pointer }
 
 
         movq        %rax, (%rdx)        { Write value to destination.  }
         movq        %rax, (%rdx)        { Write value to destination.  }
         addq        $8, %rdx        { Adjust pointer.  }
         addq        $8, %rdx        { Adjust pointer.  }
-        jmp         LFPC_STRCOPY_1                { Next iteration.  }
+        jmp         .LFPC_STRCOPY_1                { Next iteration.  }
 
 
         { Do the last few bytes. %rax contains the value to write.
         { Do the last few bytes. %rax contains the value to write.
            The loop is unrolled twice.  }
            The loop is unrolled twice.  }
         .p2align 4
         .p2align 4
-LFPC_STRCOPY_3:
+.LFPC_STRCOPY_3:
         { Note that stpcpy needs to return with the value of the NUL
         { Note that stpcpy needs to return with the value of the NUL
            byte.  }
            byte.  }
         movb        %al, (%rdx)        { 1st byte.  }
         movb        %al, (%rdx)        { 1st byte.  }
         testb       %al, %al        { Is it NUL.  }
         testb       %al, %al        { Is it NUL.  }
-        jz          LFPC_STRCOPY_4                { yes, finish.  }
+        jz          .LFPC_STRCOPY_4                { yes, finish.  }
         incq        %rdx                { Increment destination.  }
         incq        %rdx                { Increment destination.  }
         movb        %ah, (%rdx)        { 2nd byte.  }
         movb        %ah, (%rdx)        { 2nd byte.  }
         testb       %ah, %ah        { Is it NUL?.  }
         testb       %ah, %ah        { Is it NUL?.  }
-        jz          LFPC_STRCOPY_4                { yes, finish.  }
+        jz          .LFPC_STRCOPY_4                { yes, finish.  }
         incq        %rdx                { Increment destination.  }
         incq        %rdx                { Increment destination.  }
         shrq        $16, %rax        { Shift...  }
         shrq        $16, %rax        { Shift...  }
-        jmp         LFPC_STRCOPY_3                { and look at next two bytes in %rax.  }
+        jmp         .LFPC_STRCOPY_3                { and look at next two bytes in %rax.  }
 
 
-LFPC_STRCOPY_4:
+.LFPC_STRCOPY_4:
         movq        %rdi, %rax        { Source is return value.  }
         movq        %rdi, %rax        { Source is return value.  }
         retq
         retq
 end;
 end;
@@ -151,21 +151,21 @@ end;
 
 
 {$define FPC_UNIT_HAS_STRCOMP}
 {$define FPC_UNIT_HAS_STRCOMP}
 { Created from glibc: libc/sysdeps/x86_64/strcmp.S Version 1.2 }
 { Created from glibc: libc/sysdeps/x86_64/strcmp.S Version 1.2 }
-function StrComp(Str1, Str2: PChar): StrLenInt;
+function StrComp(Str1, Str2: PChar): StrLenInt;assembler;
 asm
 asm
-FPC_STRCMP_LOOP:
+.LFPC_STRCMP_LOOP:
         movb        (%rdi), %al
         movb        (%rdi), %al
         cmpb        (%rsi), %al
         cmpb        (%rsi), %al
-        jne         FPC_STRCMP_NEG
+        jne         .LFPC_STRCMP_NEG
         incq        %rdi
         incq        %rdi
         incq        %rsi
         incq        %rsi
         testb       %al, %al
         testb       %al, %al
-        jnz         FPC_STRCMP_LOOP
+        jnz         .LFPC_STRCMP_LOOP
 
 
         xorq        %rax, %rax
         xorq        %rax, %rax
         ret
         ret
 
 
-FPC_STRCMP_NEG:
+.LFPC_STRCMP_NEG:
         movl        $1, %eax
         movl        $1, %eax
         movl        $-1, %ecx
         movl        $-1, %ecx
         cmovbl      %ecx, %eax
         cmovbl      %ecx, %eax
@@ -174,7 +174,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2003-04-30 22:11:06  florian
+  Revision 1.3  2004-02-18 22:00:59  peter
+    * use strlenint instead of longint
+
+  Revision 1.2  2003/04/30 22:11:06  florian
     + for a lot of x86-64 dependend files mostly dummies added
     + for a lot of x86-64 dependend files mostly dummies added
 
 
   Revision 1.1  2003/04/30 16:36:39  florian
   Revision 1.1  2003/04/30 16:36:39  florian

+ 27 - 24
rtl/x86_64/strlen.inc

@@ -20,23 +20,23 @@ asm
         movq %rdi, %rcx                { Duplicate source pointer. }
         movq %rdi, %rcx                { Duplicate source pointer. }
         andl $7, %ecx                  { mask alignment bits }
         andl $7, %ecx                  { mask alignment bits }
         movq %rdi, %rax                { duplicate destination.  }
         movq %rdi, %rax                { duplicate destination.  }
-        jz LFPC_STRLEN_1               { aligned => start loop }
+        jz .LFPC_STRLEN_1               { aligned => start loop }
 
 
         neg %ecx                       { We need to align to 8 bytes.  }
         neg %ecx                       { We need to align to 8 bytes.  }
         addl $8,%ecx
         addl $8,%ecx
         { Search the first bytes directly.  }
         { Search the first bytes directly.  }
-LFPC_STRLEN_0:
+.LFPC_STRLEN_0:
         cmpb $0x0,(%rax)                { is byte NUL? }
         cmpb $0x0,(%rax)                { is byte NUL? }
-        je LFPC_STRLEN_2                { yes => return }
+        je .LFPC_STRLEN_2                { yes => return }
         incq %rax                       { increment pointer }
         incq %rax                       { increment pointer }
         decl %ecx
         decl %ecx
-        jnz LFPC_STRLEN_0
+        jnz .LFPC_STRLEN_0
 
 
-LFPC_STRLEN_1:
+.LFPC_STRLEN_1:
          movq $0xfefefefefefefeff,%r8  { Save magic.  }
          movq $0xfefefefefefefeff,%r8  { Save magic.  }
 
 
         .p2align 4                     { Align loop.  }
         .p2align 4                     { Align loop.  }
-LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
+.LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
         { First unroll.  }
         { First unroll.  }
         movq (%rax), %rcx              { get double word (= 8 bytes) in question }
         movq (%rax), %rcx              { get double word (= 8 bytes) in question }
         addq $8,%rax                   { adjust pointer for next word }
         addq $8,%rax                   { adjust pointer for next word }
@@ -44,12 +44,12 @@ LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
         addq %rcx, %rdx                { add the magic value to the word.  We get
         addq %rcx, %rdx                { add the magic value to the word.  We get
                                          carry bits reported for each byte which
                                          carry bits reported for each byte which
                                          is *not* 0 }
                                          is *not* 0 }
-        jnc LFPC_STRLEN_3               { highest byte is NUL => return pointer }
+        jnc .LFPC_STRLEN_3               { highest byte is NUL => return pointer }
         xorq %rcx, %rdx                { (word+magic)^word }
         xorq %rcx, %rdx                { (word+magic)^word }
         orq %r8, %rdx                  { set all non-carry bits }
         orq %r8, %rdx                  { set all non-carry bits }
         incq %rdx                      { add 1: if one carry bit was *not* set
         incq %rdx                      { add 1: if one carry bit was *not* set
                                          the addition will not result in 0.  }
                                          the addition will not result in 0.  }
-        jnz LFPC_STRLEN_3               { found NUL => return pointer }
+        jnz .LFPC_STRLEN_3               { found NUL => return pointer }
 
 
         { Second unroll.  }
         { Second unroll.  }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
@@ -58,12 +58,12 @@ LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
         addq %rcx, %rdx                { add the magic value to the word.  We get
         addq %rcx, %rdx                { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
+        jnc .LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
         xorq %rcx, %rdx                { (word+magic)^word }
         xorq %rcx, %rdx                { (word+magic)^word }
         orq %r8, %rdx                { set all non-carry bits }
         orq %r8, %rdx                { set all non-carry bits }
         incq %rdx                { add 1: if one carry bit was *not* set
         incq %rdx                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
-        jnz LFPC_STRLEN_3                        { found NUL => return pointer }
+        jnz .LFPC_STRLEN_3                        { found NUL => return pointer }
 
 
         { Third unroll.  }
         { Third unroll.  }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
@@ -72,12 +72,12 @@ LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
         addq %rcx, %rdx                { add the magic value to the word.  We get
         addq %rcx, %rdx                { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
+        jnc .LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
         xorq %rcx, %rdx                { (word+magic)^word }
         xorq %rcx, %rdx                { (word+magic)^word }
         orq %r8, %rdx                { set all non-carry bits }
         orq %r8, %rdx                { set all non-carry bits }
         incq %rdx                { add 1: if one carry bit was *not* set
         incq %rdx                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
-        jnz LFPC_STRLEN_3                        { found NUL => return pointer }
+        jnz .LFPC_STRLEN_3                        { found NUL => return pointer }
 
 
         { Fourth unroll.  }
         { Fourth unroll.  }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
         movq (%rax), %rcx        { get double word (= 8 bytes) in question }
@@ -86,47 +86,47 @@ LFPC_STRLEN_4:                          { Main Loop is unrolled 4 times.  }
         addq %rcx, %rdx                { add the magic value to the word.  We get
         addq %rcx, %rdx                { add the magic value to the word.  We get
                                    carry bits reported for each byte which
                                    carry bits reported for each byte which
                                    is *not* 0 }
                                    is *not* 0 }
-        jnc LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
+        jnc .LFPC_STRLEN_3                        { highest byte is NUL => return pointer }
         xorq %rcx, %rdx                { (word+magic)^word }
         xorq %rcx, %rdx                { (word+magic)^word }
         orq %r8, %rdx                { set all non-carry bits }
         orq %r8, %rdx                { set all non-carry bits }
         incq %rdx                { add 1: if one carry bit was *not* set
         incq %rdx                { add 1: if one carry bit was *not* set
                                    the addition will not result in 0.  }
                                    the addition will not result in 0.  }
-        jz LFPC_STRLEN_4                        { no NUL found => continue loop }
+        jz .LFPC_STRLEN_4                        { no NUL found => continue loop }
 
 
         .p2align 4                { Align, it's a jump target.  }
         .p2align 4                { Align, it's a jump target.  }
-LFPC_STRLEN_3:
+.LFPC_STRLEN_3:
         subq $8,%rax                { correct pointer increment.  }
         subq $8,%rax                { correct pointer increment.  }
 
 
         testb %cl, %cl                { is first byte NUL? }
         testb %cl, %cl                { is first byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return }
+        jz .LFPC_STRLEN_2                        { yes => return }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         testb %ch, %ch                { is second byte NUL? }
         testb %ch, %ch                { is second byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return }
+        jz .LFPC_STRLEN_2                        { yes => return }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         testl $0x00ff0000, %ecx { is third byte NUL? }
         testl $0x00ff0000, %ecx { is third byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return pointer }
+        jz .LFPC_STRLEN_2                        { yes => return pointer }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         testl $0xff000000, %ecx { is fourth byte NUL? }
         testl $0xff000000, %ecx { is fourth byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return pointer }
+        jz .LFPC_STRLEN_2                        { yes => return pointer }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         shrq $32, %rcx                { look at other half.  }
         shrq $32, %rcx                { look at other half.  }
 
 
         testb %cl, %cl                { is first byte NUL? }
         testb %cl, %cl                { is first byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return }
+        jz .LFPC_STRLEN_2                        { yes => return }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         testb %ch, %ch                { is second byte NUL? }
         testb %ch, %ch                { is second byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return }
+        jz .LFPC_STRLEN_2                        { yes => return }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
 
 
         testl $0xff0000, %ecx        { is third byte NUL? }
         testl $0xff0000, %ecx        { is third byte NUL? }
-        jz LFPC_STRLEN_2                        { yes => return pointer }
+        jz .LFPC_STRLEN_2                        { yes => return pointer }
         incq %rax                { increment pointer }
         incq %rax                { increment pointer }
-LFPC_STRLEN_2:
+.LFPC_STRLEN_2:
         subq %rdi, %rax                { compute difference to string start }
         subq %rdi, %rax                { compute difference to string start }
         ret
         ret
 end;
 end;
@@ -134,7 +134,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2003-04-30 16:36:39  florian
+  Revision 1.2  2004-02-18 22:00:59  peter
+    * use strlenint instead of longint
+
+  Revision 1.1  2003/04/30 16:36:39  florian
     + support for generic pchar routines added
     + support for generic pchar routines added
     + some basic rtl stuff for x86-64 added
     + some basic rtl stuff for x86-64 added
 }
 }