annotate libgo/runtime/go-string.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* go-string.h -- the string type for Go.
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 Copyright 2009 The Go Authors. All rights reserved.
kono
parents:
diff changeset
4 Use of this source code is governed by a BSD-style
kono
parents:
diff changeset
5 license that can be found in the LICENSE file. */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 #ifndef LIBGO_GO_STRING_H
kono
parents:
diff changeset
8 #define LIBGO_GO_STRING_H
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 #include <stddef.h>
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 static inline _Bool
kono
parents:
diff changeset
13 __go_strings_equal (String s1, String s2)
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 return (s1.len == s2.len
kono
parents:
diff changeset
16 && __builtin_memcmp (s1.str, s2.str, s1.len) == 0);
kono
parents:
diff changeset
17 }
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 static inline _Bool
kono
parents:
diff changeset
20 __go_ptr_strings_equal (const String *ps1, const String *ps2)
kono
parents:
diff changeset
21 {
kono
parents:
diff changeset
22 if (ps1 == NULL)
kono
parents:
diff changeset
23 return ps2 == NULL;
kono
parents:
diff changeset
24 if (ps2 == NULL)
kono
parents:
diff changeset
25 return 0;
kono
parents:
diff changeset
26 return __go_strings_equal (*ps1, *ps2);
kono
parents:
diff changeset
27 }
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 extern int __go_get_rune (const unsigned char *, size_t, int32 *);
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 #endif /* !defined(LIBGO_GO_STRING_H) */