1
/* Copyright (C) 2000 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
Author : Richard A. O'Keefe. / Monty
18
Michael Widenius; ifdef MC68000
22
strlen(s) returns the number of characters in s, that is, the number
23
of non-NUL characters found before the closing NULEosCh. Note: some
24
non-standard C compilers for 32-bit machines take int to be 16 bits,
25
either put up with short strings or change int to long throughout
26
this package. Better yet, BOYCOTT such shoddy compilers.
27
Beware: the asm version works only if strlen(s) < 65536.
34
size_t strlen(char *s)
36
asm("locc $0,$65535,*4(ap)");
37
asm("subl3 r0,$65535,r0");
41
#if defined(MC68000) && defined(DS90)
43
size_t strlen(char *s)
45
asm(" movl 4(a7),a0 ");
47
asm(".L4: tstb (a0)+ ");
55
size_t strlen(register char *s)
57
register char *startpos;
61
return ((size_t) (s-startpos-1));