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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-strcmp.c] - Blame information for rev 791

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-strcmp.c -- the go string comparison function.
2
 
3
   Copyright 2009 The Go Authors. All rights reserved.
4
   Use of this source code is governed by a BSD-style
5
   license that can be found in the LICENSE file.  */
6
 
7
#include "go-string.h"
8
 
9
int
10
__go_strcmp(struct __go_string s1, struct __go_string s2)
11
{
12
  int i;
13
 
14
  i = __builtin_memcmp(s1.__data, s2.__data,
15
                       (s1.__length < s2.__length
16
                        ? s1.__length
17
                        : s2.__length));
18
  if (i != 0)
19
    return i;
20
 
21
  if (s1.__length < s2.__length)
22
    return -1;
23
  else if (s1.__length > s2.__length)
24
    return 1;
25
  else
26
    return 0;
27
}

powered by: WebSVN 2.1.0

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