[Joafip-svn] SF.net SVN: joafip:[3067] trunk/joafip-kvstore/src/main/java/net/sf/joafip/ kvstore/e
Brought to you by:
luc_peuvrier
|
From: <luc...@us...> - 2012-05-04 16:19:06
|
Revision: 3067
http://joafip.svn.sourceforge.net/joafip/?rev=3067&view=rev
Author: luc_peuvrier
Date: 2012-05-04 16:18:55 +0000 (Fri, 04 May 2012)
Log Message:
-----------
WIP btree plus: tests OK : WIP check and optimization : update crc32 change
Modified Paths:
--------------
trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/entity/AbstractFileStorable.java
Modified: trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/entity/AbstractFileStorable.java
===================================================================
--- trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/entity/AbstractFileStorable.java 2012-05-04 05:07:30 UTC (rev 3066)
+++ trunk/joafip-kvstore/src/main/java/net/sf/joafip/kvstore/entity/AbstractFileStorable.java 2012-05-04 16:18:55 UTC (rev 3067)
@@ -200,7 +200,8 @@
}
- private void updateCrc32(final byte byteValue) {
+ @SuppressWarnings("unused")
+ private void _updateCrc32(final byte byteValue) {
int value = byteValue;
for (int j = 0; j < 8; j++) {
final int testbit = ((crc32 >> 31) & 1) ^ (value & 1);
@@ -212,6 +213,59 @@
}
}
+ private void updateCrc32(final byte byteValue) {
+ int crc32=this.crc32;
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x01) == 0x01) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x02) == 0x02) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x04) == 0x04) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x08) == 0x08) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x10) == 0x10) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x20) == 0x20) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x40) == 0x40) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ if ((crc32 & 0x80000000) == 0x80000000 ^ (byteValue & 0x80) == 0x80) {
+ crc32 <<= 2;
+ crc32 ^= 0x8005; /* 32 bit crc */
+ } else {
+ crc32 <<= 2;
+ }
+ this.crc32=crc32;
+ }
+
protected void clearCrc32() {
crc32 = 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|