GEOS  3.3.3
CommonBits.h
1 /**********************************************************************
2  * $Id: CommonBits.h 2556 2009-06-06 22:22:28Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_PRECISION_COMMONBITS_H
17 #define GEOS_PRECISION_COMMONBITS_H
18 
19 #include <geos/export.h>
20 #include <geos/platform.h> // for int64
21 
22 namespace geos {
23 namespace precision { // geos.precision
24 
34 class GEOS_DLL CommonBits {
35 
36 private:
37 
38  bool isFirst;
39 
40  int commonMantissaBitsCount;
41 
42  int64 commonBits;
43 
44  int64 commonSignExp;
45 
46 public:
47 
55  static int64 signExpBits(int64 num);
56 
68  static int numCommonMostSigMantissaBits(int64 num1, int64 num2);
69 
77  static int64 zeroLowerBits(int64 bits, int nBits);
78 
86  static int getBit(int64 bits, int i);
87 
88  CommonBits();
89 
90  void add(double num);
91 
92  double getCommon();
93 
94 };
95 
96 } // namespace geos.precision
97 } // namespace geos
98 
99 #endif // GEOS_PRECISION_COMMONBITS_H
100 
101 /**********************************************************************
102  * $Log$
103  * Revision 1.1 2006/03/23 09:17:19 strk
104  * precision.h header split, minor optimizations
105  *
106  **********************************************************************/