⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commonbits.h

📁 在Linux下做的QuadTree的程序
💻 H
字号:
/********************************************************************** * $Id: CommonBits.h 1820 2006-09-06 16:54:23Z mloskot $ * * GEOS - Geometry Engine Open Source * http://geos.refractions.net * * Copyright (C) 2005-2006 Refractions Research Inc. * * This is free software; you can redistribute and/or modify it under * the terms of the GNU Lesser General Public Licence as published * by the Free Software Foundation.  * See the COPYING file for more information. * **********************************************************************/#ifndef GEOS_PRECISION_COMMONBITS_H#define GEOS_PRECISION_COMMONBITS_H#include <geos/platform.h> // for int64namespace geos {namespace precision { // geos.precision/** \brief * Determines the maximum number of common most-significant * bits in the mantissa of one or numbers. * * Can be used to compute the double-precision number which * is represented by the common bits. * If there are no common bits, the number computed is 0.0. * */class CommonBits {private:	bool isFirst;	int commonMantissaBitsCount;	int64 commonBits;	int64 commonSignExp;public:	/** \brief	 * Computes the bit pattern for the sign and exponent of a	 * double-precision number.	 *	 * @param num	 * @return the bit pattern for the sign and exponent	 */	static int64 signExpBits(int64 num);	/** \brief	 * This computes the number of common most-significant	 * bits in the mantissas of two double-precision numbers.	 *	 * It does not count the hidden bit, which is always 1.	 * It does not determine whether the numbers have the same	 * exponent - if they do not, the value computed by this	 * function is meaningless.	 * @param db	 * @return the number of common most-significant mantissa bits	 */	static int numCommonMostSigMantissaBits(int64 num1, int64 num2);	/** \brief	 * Zeroes the lower n bits of a bitstring.	 *	 * @param bits the bitstring to alter	 * @param i the number of bits to zero	 * @return the zeroed bitstring	 */	static int64 zeroLowerBits(int64 bits, int nBits);	/** \brief	 * Extracts the i'th bit of a bitstring.	 *	 * @param bits the bitstring to extract from	 * @param i the bit to extract	 * @return the value of the extracted bit	 */	static int getBit(int64 bits, int i);	CommonBits();	void add(double num);	double getCommon();};} // namespace geos.precision} // namespace geos#endif // GEOS_PRECISION_COMMONBITS_H/********************************************************************** * $Log$ * Revision 1.1  2006/03/23 09:17:19  strk * precision.h header split, minor optimizations * **********************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -