Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HashFunction.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* HashFunction.h (C) 2000-2024 */
9/* */
10/* Fonction de hachage. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_HASHFUNCTION_H
13#define ARCANE_UTILS_HASHFUNCTION_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
31template <class Type>
33{
34};
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
44template <>
46{
47 public:
48
49 static constexpr ARCCORE_HOST_DEVICE Int32 hashfunc(Int32 key)
50 {
51 key += ~(key << 15);
52 key ^= (key >> 10);
53 key += (key << 3);
54 key ^= (key >> 6);
55 key += ~(key << 11);
56 key ^= (key >> 16);
57 return key;
58 }
59};
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
69template <>
71{
72 public:
73
74 static constexpr ARCCORE_HOST_DEVICE Int64 hashfunc(Int64 key)
75 {
76 key += ~(key << 32);
77 key ^= (key >> 22);
78 key += ~(key << 13);
79 key ^= (key >> 8);
80 key += (key << 3);
81 key ^= (key >> 15);
82 key += ~(key << 27);
83 key ^= (key >> 31);
84 return key;
85 }
86};
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
94template <>
96{
97 public:
98
99 ARCANE_UTILS_EXPORT static Int64 hashfunc(StringView str);
100};
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
107template <typename KeyType>
109{
110 public:
111
112 typedef const KeyType& KeyTypeConstRef;
113 typedef KeyType& KeyTypeRef;
114 typedef KeyType KeyTypeValue;
115 typedef KeyType HashValueType;
116 typedef FalseType Printable;
117
118 public:
119
120 static HashValueType hashFunction(KeyTypeConstRef key);
121};
122
123/*---------------------------------------------------------------------------*/
124/*---------------------------------------------------------------------------*/
125
130template <>
131class HashTraitsT<Int32>
132{
133 public:
134
135 typedef Int32 KeyTypeConstRef;
136 typedef Int32& KeyTypeRef;
137 typedef Int32 KeyTypeValue;
138 typedef TrueType Printable;
139 typedef Int32 HashValueType;
140
141 public:
142
143 static constexpr ARCCORE_HOST_DEVICE Int32 hashFunction(Int32 key)
144 {
146 }
147};
148
149/*---------------------------------------------------------------------------*/
150/*---------------------------------------------------------------------------*/
151
156template <>
157class HashTraitsT<Int64>
158{
159 public:
160
161 typedef Int64 KeyTypeConstRef;
162 typedef Int64& KeyTypeRef;
163 typedef Int64 KeyTypeValue;
164 typedef Int64 HashValueType;
165 typedef TrueType Printable;
166
167 public:
168
169 static constexpr ARCCORE_HOST_DEVICE Int64 hashFunction(Int64 key)
170 {
172 }
173};
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
178} // End namespace Arcane
179
180/*---------------------------------------------------------------------------*/
181/*---------------------------------------------------------------------------*/
182
183#endif
Fichier de configuration d'Arcane.
Fonctor pour une fonction de hachage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Vue sur une chaîne de caractères UTF-8.
Definition StringView.h:47
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Structure équivalente à la valeur booléenne vrai.
Structure équivalente à la valeur booléenne vrai.