OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtins/] [lib/] [strncmp.c] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
extern void abort (void);
2
extern int inside_main;
3
 
4
typedef __SIZE_TYPE__ size_t;
5
 
6
__attribute__ ((__noinline__))
7
int
8
strncmp(const char *s1, const char *s2, size_t n)
9
{
10
  const unsigned char *u1 = (const unsigned char *)s1;
11
  const unsigned char *u2 = (const unsigned char *)s2;
12
  unsigned char c1, c2;
13
 
14
#ifdef __OPTIMIZE__
15
  if (inside_main)
16
    abort();
17
#endif
18
 
19
  while (n > 0)
20
    {
21
      c1 = *u1++, c2 = *u2++;
22
      if (c1 == '\0' || c1 != c2)
23
        return c1 - c2;
24
      n--;
25
    }
26
  return c1 - c2;
27
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.