2
* $Id: GEN_HashedPtr.cpp 28254 2010-04-18 10:28:37Z campbellbarton $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#include "GEN_HashedPtr.h"
32
#include "BLO_sys_types.h" // for intptr_t support
35
// Build hash index from pointer. Even though the final result
36
// is a 32-bit integer, use all the bits of the pointer as long
40
unsigned int GEN_Hash(void * inDWord)
42
uintptr_t key = (uintptr_t)inDWord;
44
// this is way too complicated
52
return (unsigned int)(key & 0xffffffff);
54
return (unsigned int)(key ^ (key>>4));
b'\\ No newline at end of file'