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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-interface-compare.c -- compare two interface values.
2
 
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.  */
6
 
7
#include "interface.h"
8
 
9
/* Compare two interface values.  Return 0 for equal, not zero for not
10
   equal (return value is like strcmp).  */
11
 
12
int
13
__go_interface_compare (struct __go_interface left,
14
                        struct __go_interface right)
15
{
16
  const struct __go_type_descriptor *left_descriptor;
17
 
18
  if (left.__methods == NULL && right.__methods == NULL)
19
    return 0;
20
  if (left.__methods == NULL || right.__methods == NULL)
21
    return 1;
22
  left_descriptor = left.__methods[0];
23
  if (!__go_type_descriptors_equal (left_descriptor, right.__methods[0]))
24
    return 1;
25
  if (__go_is_pointer_type (left_descriptor))
26
    return left.__object == right.__object ? 0 : 1;
27
  if (!left_descriptor->__equalfn (left.__object, right.__object,
28
                                   left_descriptor->__size))
29
    return 1;
30
  return 0;
31
}

powered by: WebSVN 2.1.0

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