OSDN Git Service

Tuple receives indicate whether channel is closed.
[pf3gnuchains/gcc-fork.git] / libgo / runtime / go-strcmp.c
1 /* 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 }