summaryrefslogtreecommitdiff
path: root/libgo/go/bytes/indexbyte.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-06 19:49:01 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-06 19:49:01 +0000
commit0ce10ea1348e9afd5d0eec6bca986bfe58bac5ac (patch)
tree39530b071991b2326f881b2a30a2d82d6c133fd6 /libgo/go/bytes/indexbyte.c
parent57a8bf1b0c6057ccbacb0cf79eb84d1985c2c1fe (diff)
downloadgcc-0ce10ea1348e9afd5d0eec6bca986bfe58bac5ac.tar.gz
libgo: Update to October 24 version of master library.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/bytes/indexbyte.c')
-rw-r--r--libgo/go/bytes/indexbyte.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libgo/go/bytes/indexbyte.c b/libgo/go/bytes/indexbyte.c
index cbc7847efe8..b248108e404 100644
--- a/libgo/go/bytes/indexbyte.c
+++ b/libgo/go/bytes/indexbyte.c
@@ -41,3 +41,33 @@ Equal (struct __go_open_array a, struct __go_open_array b)
return 0;
return __builtin_memcmp (a.__values, b.__values, a.__count) == 0;
}
+
+intgo Compare (struct __go_open_array a, struct __go_open_array b)
+ __asm__ (GOSYM_PREFIX "bytes.Compare")
+ __attribute__ ((no_split_stack));
+
+intgo
+Compare (struct __go_open_array a, struct __go_open_array b)
+{
+ intgo len;
+
+ len = a.__count;
+ if (len > b.__count)
+ len = b.__count;
+ if (len > 0)
+ {
+ intgo ret;
+
+ ret = __builtin_memcmp (a.__values, b.__values, len);
+ if (ret < 0)
+ return -1;
+ else if (ret > 0)
+ return 1;
+ }
+ if (a.__count < b.__count)
+ return -1;
+ else if (a.__count > b.__count)
+ return 1;
+ else
+ return 0;
+}