Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
5f0714fe
Commit
5f0714fe
authored
Mar 15, 2019
by
Mark OLESEN
Committed by
Andrew Heather
Mar 15, 2019
Browse files
COMP: use intptr_t instead of long for hashing pointers
parent
a9096858
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/primitives/hashes/Hash/Hash.H
View file @
5f0714fe
...
...
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2018
-2019
OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2012 OpenFOAM Foundation
...
...
@@ -51,10 +51,10 @@ namespace Foam
Class Hash Declaration
\*---------------------------------------------------------------------------*/
template
<
class
PrimitiveType
>
template
<
class
T
>
struct
Hash
{
inline
unsigned
operator
()(
const
PrimitiveType
&
obj
,
unsigned
seed
=
0
)
const
inline
unsigned
operator
()(
const
T
&
obj
,
unsigned
seed
=
0
)
const
{
return
Hasher
(
&
obj
,
sizeof
(
obj
),
seed
);
}
...
...
@@ -140,19 +140,18 @@ struct Hash<Foam::keyType>
};
//- Hash specialization for pointers.
// Interpret pointer as a long (works for 32-bit and 64-bit pointers).
//- Hash specialization for pointers, interpret pointer as a integer type.
template
<
>
struct
Hash
<
void
*>
{
inline
unsigned
operator
()(
const
void
*
const
&
obj
,
unsigned
seed
)
const
{
return
Hash
<
long
>
()(
long
(
obj
),
seed
);
return
Hash
<
intptr_t
>
()(
intptr_t
(
obj
),
seed
);
}
inline
unsigned
operator
()(
const
void
*
const
&
obj
)
const
{
return
Hash
<
long
>
()(
long
(
obj
));
return
Hash
<
intptr_t
>
()(
intptr_t
(
obj
));
}
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment