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

Subversion Repositories openrisc

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

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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