1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 typedef unsigned char byte;
11 typedef struct __go_channel chan;
13 /* Do a nonblocking channel receive. */
15 func chanrecv2(c *chan, val *byte) (pres bool) {
16 if (c->element_size > 8) {
17 return __go_receive_nonblocking_big(c, val);
19 struct __go_receive_nonblocking_small rs;
25 rs = __go_receive_nonblocking_small (c);
27 __builtin_memset(val, 0, c->element_size);
31 #ifndef WORDS_BIGENDIAN
32 __builtin_memcpy(val, u.b, c->element_size);
34 __builtin_memcpy(val, u.b + 8 - c->element_size,