# CommonBits.h

    00001 /**********************************************************************
    00002  * $Id: CommonBits.h 1820 2006-09-06 16:54:23Z mloskot $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005-2006 Refractions Research Inc.
    00008  *
    00009  * This is free software; you can redistribute and/or modify it under
    00010  * the terms of the GNU Lesser General Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  **********************************************************************/
    00015
    00016 #ifndef GEOS_PRECISION_COMMONBITS_H
    00017 #define GEOS_PRECISION_COMMONBITS_H
    00018
    00019 #include <geos/platform.h> // for int64
    00020
    00021 namespace geos {
    00022 namespace precision { // geos.precision
    00023
    00033 class 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
    00099
    00100 /**********************************************************************
    00101  * $Log$
    00102  * Revision 1.1  2006/03/23 09:17:19  strk
    00103  * precision.h header split, minor optimizations
    00104  *
    00105  **********************************************************************/