sh.h (PREFERRED_RELOAD_CLASS): Remove.
[official-gcc.git] / libgo / go / bytes / indexbyte.c
bloba0a963e93f669fdeea2c38b5868dd1b4020c945e
1 /* indexbyte.c -- implement bytes.IndexByte for Go.
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. */
7 #include <stddef.h>
9 #include "array.h"
11 /* This is in C so that the compiler can optimize it appropriately.
12 We deliberately don't split the stack in case it does call the
13 library function, which shouldn't need much stack space. */
15 int IndexByte (struct __go_open_array, char)
16 asm ("libgo_bytes.bytes.IndexByte")
17 __attribute__ ((no_split_stack));
19 int
20 IndexByte (struct __go_open_array s, char b)
22 char *p;
24 p = __builtin_memchr (s.__values, b, s.__count);
25 if (p == NULL)
26 return -1;
27 return p - (char *) s.__values;