fixes for host gcc 4.6.1
[zpugcc/jano.git] / toolchain / gcc / newlib / libc / machine / m68k / strlen.c
blob589a697517b90d0f6a0caa7b7c35aa99686e2ea1
1 /*
2 * C library strlen routine
4 * This routine has been optimized for the CPU32+.
5 * It should run on all 68k machines.
7 * W. Eric Norum
8 * Saskatchewan Accelerator Laboratory
9 * University of Saskatchewan
10 * Saskatoon, Saskatchewan, CANADA
11 * eric@skatter.usask.ca
14 #include <string.h>
17 * Test bytes using CPU32+ loop mode if possible.
19 size_t
20 strlen (const char *str)
22 unsigned int n = ~0;
23 const char *cp = str;
25 asm volatile ("1:\n"
26 "\ttst.b (%0)+\n"
27 #if defined(__mcpu32__)
28 "\tdbeq %1,1b\n"
29 #endif
30 "\tbne.b 1b\n" :
31 "=a" (cp), "=d" (n) :
32 "0" (cp), "1" (n) :
33 "cc");
34 return (cp - str) - 1;