OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-eface-val-compare.c] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-eface-val-compare.c -- compare an empty interface with a value.
2
 
3
   Copyright 2010 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 "runtime.h"
8
#include "go-type.h"
9
#include "interface.h"
10
 
11
/* Compare an empty interface with a value.  Return 0 for equal, not
12
   zero for not equal (return value is like strcmp).  */
13
 
14
int
15
__go_empty_interface_value_compare (
16
    struct __go_empty_interface left,
17
    const struct __go_type_descriptor *right_descriptor,
18
    const void *val)
19
{
20
  const struct __go_type_descriptor *left_descriptor;
21
 
22
  left_descriptor = left.__type_descriptor;
23
  if (((uintptr_t) left_descriptor & reflectFlags) != 0)
24
    runtime_panicstring ("invalid interface value");
25
  if (left_descriptor == NULL)
26
    return 1;
27
  if (!__go_type_descriptors_equal (left_descriptor, right_descriptor))
28
    return 1;
29
  if (__go_is_pointer_type (left_descriptor))
30
    return left.__object == val ? 0 : 1;
31
  if (!left_descriptor->__equalfn (left.__object, val,
32
                                   left_descriptor->__size))
33
    return 1;
34
  return 0;
35
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.