Salome HOME
Remove OCC_LIBS from LDFLAGS
[modules/smesh.git] / src / SMDS / SMDS_PntHasher.lxx
1 //  SMESH SMDS : implementaion of Salome mesh data structure
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library 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 GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMDS_PntHasher.lxx
25 //  Author : Jean-Michel BOULCOURT
26 //  Module : SMESH
27
28 #include <gp_Pnt.hxx>
29
30 static Standard_Real tab1[3];
31 static Standard_Real tab2[3];
32
33 //=======================================================================
34 //function : HashCode
35 //purpose  : 
36 //=======================================================================
37 inline Standard_Integer  SMDS_PntHasher::HashCode
38   (const gp_Pnt& point, const Standard_Integer Upper)
39 {
40   union 
41     {
42     Standard_Real R[3];
43     Standard_Integer I[6];
44     } U;
45
46   point.Coord(U.R[0],U.R[1],U.R[2]);  
47
48   return ::HashCode(U.I[0]/23+U.I[1]/19+U.I[2]/17+U.I[3]/13+U.I[4]/11+U.I[5]/7,Upper);
49   //  return ::HashCode((U.I[0]>>4)+(U.I[1]>>3)+(U.I[2]>>2)+(U.I[3]>>1)+(U.I[4]>>4)+(U.I[5]>>3),Upper);
50
51 }
52
53 //=======================================================================
54 //function : IsEqual
55 //purpose  : 
56 //=======================================================================
57 inline Standard_Boolean  SMDS_PntHasher::IsEqual
58   (const gp_Pnt& point1, const gp_Pnt& point2)
59 {
60   point1.Coord(tab1[0],tab1[1],tab1[2]);  
61   point2.Coord(tab2[0],tab2[1],tab2[2]);  
62   return (memcmp(tab1,tab2,sizeof(tab1)) == 0);
63 }