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

📄 fast.java

📁 MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package it.unimi.dsi.mg4j.util;/*		  * MG4J: Managing Gigabytes for Java * * Copyright (C) 2002-2007 Sebastiano Vigna  * *  This library is free software; you can redistribute it and/or modify it *  under the terms of the GNU Lesser General Public License as published by the Free *  Software Foundation; either version 2.1 of the License, or (at your option) *  any later version. * *  This library is distributed in the hope that it will be useful, but *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License *  for more details. * *  You should have received a copy of the GNU Lesser General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */import java.util.Enumeration;import org.apache.log4j.BasicConfigurator;import org.apache.log4j.Level;import org.apache.log4j.LogManager;import org.apache.log4j.Logger;/** All-purpose optimised static-method container class. * * <P>This class contains static optimised utility methods that are used by all * MG4J classes. * * @author Sebastiano Vigna * @since 0.1 */public final class Fast {	private Fast() {}	/** Computes the most significant bit of an integer.	 *	 * @param x an integer.	 * @return the most significant bit of the argument (-1 for 0).	 * @deprecated Moved to <code>dsiutils</code>.	 */	@Deprecated	public static int mostSignificantBit( final int x ) {		return			( x < 1<<15 ?				( x < 1<<7 ?					( x < 1<<3 ?						( x < 1<<1 ?							( x < 1<<0 ?								x < 0 ? 31 : -1 /* 6 */							:								0 /* 5 */							)						:							( x < 1<<2 ?								1 /* 5 */							:								2 /* 5 */							)						)					:						( x < 1<<5 ?							( x < 1<<4 ?								3 /* 5 */							:								4 /* 5 */							)						:							( x < 1<<6 ?								5 /* 5 */							:								6 /* 5 */							)						)					)				:					( x < 1<<11 ?						( x < 1<<9 ?							( x < 1<<8 ?								7 /* 5 */							:								8 /* 5 */							)						:							( x < 1<<10 ?								9 /* 5 */							:								10 /* 5 */							)						)					:						( x < 1<<13 ?							( x < 1<<12 ?								11 /* 5 */							:								12 /* 5 */							)						:							( x < 1<<14 ?								13 /* 5 */							:								14 /* 5 */							)						)					)				)			:				( x < 1<<23 ?					( x < 1<<19 ?						( x < 1<<17 ?							( x < 1<<16 ?								15 /* 5 */							:								16 /* 5 */							)						:							( x < 1<<18 ?								17 /* 5 */							:								18 /* 5 */							)						)					:						( x < 1<<21 ?							( x < 1<<20 ?								19 /* 5 */							:								20 /* 5 */							)						:							( x < 1<<22 ?								21 /* 5 */							:								22 /* 5 */							)						)					)				:					( x < 1<<27 ?						( x < 1<<25 ?							( x < 1<<24 ?								23 /* 5 */							:								24 /* 5 */							)						:							( x < 1<<26 ?								25 /* 5 */							:								26 /* 5 */							)						)					:						( x < 1<<29 ?							( x < 1<<28 ?								27 /* 5 */							:								28 /* 5 */							)						:							( x < 1<<30 ?								29 /* 5 */							:								30 /* 5 */							)						)					)				)			);	}	/** Computes the most significant bit of a long integer.	 *	 * @param x a long integer.	 * @return the most significant bit of the argument (-1 for 0).	 * @deprecated Moved to <code>dsiutils</code>.	 */	@Deprecated    public static int mostSignificantBit( final long x ) {		return			( x < 1L<<31 ?				( x < 1L<<15 ?					( x < 1L<<7 ?						( x < 1L<<3 ?							( x < 1L<<1 ?								( x < 1L<<0 ?									x < 0 ? 63 : -1 /* 7 */								:									0 /* 6 */								)							:								( x < 1L<<2 ?									1 /* 6 */								:									2 /* 6 */								)							)						:							( x < 1L<<5 ?								( x < 1L<<4 ?									3 /* 6 */								:									4 /* 6 */								)							:								( x < 1L<<6 ?									5 /* 6 */								:									6 /* 6 */								)							)						)					:						( x < 1L<<11 ?							( x < 1L<<9 ?								( x < 1L<<8 ?									7 /* 6 */								:									8 /* 6 */								)							:								( x < 1L<<10 ?									9 /* 6 */								:									10 /* 6 */								)							)						:							( x < 1L<<13 ?								( x < 1L<<12 ?									11 /* 6 */								:									12 /* 6 */								)							:								( x < 1L<<14 ?									13 /* 6 */								:									14 /* 6 */								)							)						)					)				:					( x < 1L<<23 ?						( x < 1L<<19 ?							( x < 1L<<17 ?								( x < 1L<<16 ?									15 /* 6 */								:									16 /* 6 */								)							:								( x < 1L<<18 ?									17 /* 6 */								:									18 /* 6 */								)							)						:							( x < 1L<<21 ?								( x < 1L<<20 ?									19 /* 6 */								:									20 /* 6 */								)							:								( x < 1L<<22 ?									21 /* 6 */								:									22 /* 6 */								)							)						)					:						( x < 1L<<27 ?							( x < 1L<<25 ?								( x < 1L<<24 ?									23 /* 6 */								:									24 /* 6 */								)							:								( x < 1L<<26 ?									25 /* 6 */								:									26 /* 6 */								)							)						:							( x < 1L<<29 ?								( x < 1L<<28 ?									27 /* 6 */								:									28 /* 6 */								)							:								( x < 1L<<30 ?									29 /* 6 */								:									30 /* 6 */								)							)						)					)				)			:				( x < 1L<<47 ?					( x < 1L<<39 ?						( x < 1L<<35 ?							( x < 1L<<33 ?								( x < 1L<<32 ?									31 /* 6 */								:									32 /* 6 */								)							:								( x < 1L<<34 ?									33 /* 6 */								:									34 /* 6 */								)							)						:							( x < 1L<<37 ?								( x < 1L<<36 ?									35 /* 6 */								:									36 /* 6 */								)							:								( x < 1L<<38 ?									37 /* 6 */								:									38 /* 6 */								)							)						)					:						( x < 1L<<43 ?							( x < 1L<<41 ?								( x < 1L<<40 ?									39 /* 6 */								:									40 /* 6 */								)							:								( x < 1L<<42 ?									41 /* 6 */								:									42 /* 6 */								)							)						:							( x < 1L<<45 ?								( x < 1L<<44 ?									43 /* 6 */								:									44 /* 6 */								)							:								( x < 1L<<46 ?									45 /* 6 */								:									46 /* 6 */								)							)						)					)				:					( x < 1L<<55 ?						( x < 1L<<51 ?							( x < 1L<<49 ?								( x < 1L<<48 ?									47 /* 6 */								:									48 /* 6 */								)

⌨️ 快捷键说明

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