source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/tools/avr/lib/gcc/avr/4.9.2/plugin/include/tree-hasher.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 1.5 KB
Line 
1/* Hash Table Helper for Trees
2   Copyright (C) 2012-2014 Free Software Foundation, Inc.
3   Contributed by Lawrence Crowl <crowl@google.com>
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3.  If not see
19<http://www.gnu.org/licenses/>.  */
20
21#ifndef GCC_TREE_HASHER_H
22#define GCC_TREE_HASHER_H 1
23
24#include "hash-table.h"
25
26struct int_tree_map {
27  unsigned int uid;
28  tree to;
29};
30
31/* Hashtable helpers.  */
32
33struct int_tree_hasher : typed_free_remove <int_tree_map>
34{
35  typedef int_tree_map value_type;
36  typedef int_tree_map compare_type;
37  static inline hashval_t hash (const value_type *);
38  static inline bool equal (const value_type *, const compare_type *);
39};
40
41/* Hash a UID in a int_tree_map.  */
42
43inline hashval_t
44int_tree_hasher::hash (const value_type *item)
45{
46  return item->uid;
47}
48
49/* Return true if the uid in both int tree maps are equal.  */
50
51inline bool
52int_tree_hasher::equal (const value_type *a, const compare_type *b)
53{
54  return (a->uid == b->uid);
55}
56
57typedef hash_table <int_tree_hasher> int_tree_htab_type;
58
59#endif /* GCC_TREE_HASHER_H  */
Note: See TracBrowser for help on using the repository browser.