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

📄 crc32.as

📁 Papervision3d的源码
💻 AS
字号:
/*nochump.util.zip.CRC32Copyright (C) 2007 David Chang (dchang@nochump.com)This file is part of nochump.util.zip.nochump.util.zip is free software: you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.nochump.util.zip is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU Lesser General Public License for more details.You should have received a copy of the GNU Lesser General Public Licensealong with Foobar.  If not, see <http://www.gnu.org/licenses/>.*/package nochump.util.zip {		import flash.utils.ByteArray;		/**	 * Computes CRC32 data checksum of a data stream.	 * The actual CRC32 algorithm is described in RFC 1952	 * (GZIP file format specification version 4.3).	 * 	 * @author David Chang	 * @date January 2, 2007.	 */	public class CRC32 {				/** The crc data checksum so far. */		private var crc:uint;				/** The fast CRC table. Computed once when the CRC32 class is loaded. */		private static var crcTable:Array = makeCrcTable();				/** Make the table for a fast CRC. */		private static function makeCrcTable():Array {			var crcTable:Array = new Array(256);			for (var n:int = 0; n < 256; n++) {				var c:uint = n;				for (var k:int = 8; --k >= 0; ) {					if((c & 1) != 0) c = 0xedb88320 ^ (c >>> 1);					else c = c >>> 1;				}				crcTable[n] = c;			}			return crcTable;		}				/**		 * Returns the CRC32 data checksum computed so far.		 */		public function getValue():uint {			return crc & 0xffffffff;		}				/**		 * Resets the CRC32 data checksum as if no update was ever called.		 */		public function reset():void {			crc = 0;		}				/**		 * Adds the complete byte array to the data checksum.		 * 		 * @param buf the buffer which contains the data		 */		public function update(buf:ByteArray):void {			var off:uint = 0;			var len:uint = buf.length;			var c:uint = ~crc;			while(--len >= 0) c = crcTable[(c ^ buf[off++]) & 0xff] ^ (c >>> 8);			crc = ~c;		}			}	}

⌨️ 快捷键说明

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