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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-typedesc-equal.c -- return whether two type descriptors are equal.
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 "go-string.h"
8
#include "go-type.h"
9
 
10
/* Compare type descriptors for equality.  This is necessary because
11
   types may have different descriptors in different shared libraries.
12
   Also, unnamed types may have multiple type descriptors even in a
13
   single shared library.  */
14
 
15
_Bool
16
__go_type_descriptors_equal (const struct __go_type_descriptor *td1,
17
                             const struct __go_type_descriptor *td2)
18
{
19
  if (td1 == td2)
20
    return 1;
21
  /* In a type switch we can get a NULL descriptor.  */
22
  if (td1 == NULL || td2 == NULL)
23
    return 0;
24
  if (td1->__code != td2->__code || td1->__hash != td2->__hash)
25
    return 0;
26
  if (td1->__uncommon != NULL && td1->__uncommon->__name != NULL)
27
    {
28
      if (td2->__uncommon == NULL || td2->__uncommon->__name == NULL)
29
        return 0;
30
      return (__go_ptr_strings_equal (td1->__uncommon->__name,
31
                                      td2->__uncommon->__name)
32
              && __go_ptr_strings_equal (td1->__uncommon->__pkg_path,
33
                                         td2->__uncommon->__pkg_path));
34
    }
35
  if (td2->__uncommon != NULL && td2->__uncommon->__name != NULL)
36
    return 0;
37
  return __go_ptr_strings_equal (td1->__reflection, td2->__reflection);
38
}

powered by: WebSVN 2.1.0

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