GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2005-2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 00012 * 00013 **********************************************************************/ 00014 00015 #ifndef GEOS_PRECISION_COMMONBITS_H 00016 #define GEOS_PRECISION_COMMONBITS_H 00017 00018 #include <geos/export.h> 00019 #include <geos/platform.h> // for int64 00020 00021 namespace geos { 00022 namespace precision { // geos.precision 00023 00033 class GEOS_DLL CommonBits { 00034 00035 private: 00036 00037 bool isFirst; 00038 00039 int commonMantissaBitsCount; 00040 00041 int64 commonBits; 00042 00043 int64 commonSignExp; 00044 00045 public: 00046 00054 static int64 signExpBits(int64 num); 00055 00067 static int numCommonMostSigMantissaBits(int64 num1, int64 num2); 00068 00076 static int64 zeroLowerBits(int64 bits, int nBits); 00077 00085 static int getBit(int64 bits, int i); 00086 00087 CommonBits(); 00088 00089 void add(double num); 00090 00091 double getCommon(); 00092 00093 }; 00094 00095 } // namespace geos.precision 00096 } // namespace geos 00097 00098 #endif // GEOS_PRECISION_COMMONBITS_H