Author: toad
Date: 2007-11-28 20:15:00 +0000 (Wed, 28 Nov 2007)
New Revision: 16042

Modified:
   trunk/freenet/src/freenet/support/Fields.java
Log:
| not +
- may have caused inaccuracy decoding negative numbers from bytes

Modified: trunk/freenet/src/freenet/support/Fields.java
===================================================================
--- trunk/freenet/src/freenet/support/Fields.java       2007-11-28 20:13:11 UTC 
(rev 16041)
+++ trunk/freenet/src/freenet/support/Fields.java       2007-11-28 20:15:00 UTC 
(rev 16042)
@@ -502,7 +502,7 @@
             long x = 0;
             for(int j=7;j>=0;j--) {
                 long y = (buf[offset+i*8+j] & 0xff);
-                x = (x << 8) + y;
+                x = (x << 8) | y;
             }
             longs[i] = x;
         }
@@ -517,7 +517,7 @@
         long x = 0;
         for(int j=7;j>=0;j--) {
             long y = (buf[j] & 0xff);
-            x = (x << 8) + y;
+            x = (x << 8) | y;
         }
         return x;
     }
@@ -530,7 +530,7 @@
         int x = 0;
         for(int j=3;j>=0;j--) {
             int y = (buf[j+offset] & 0xff);
-            x = (x << 8) + y;
+            x = (x << 8) | y;
         }
         return x;
        }
@@ -542,7 +542,7 @@
                        int x = 0;
                        for(int j=3;j>=0;j--) {
                                int y = (buf[j+offset] & 0xff);
-                               x = (x << 8) + y;
+                               x = (x << 8) | y;
                        }
                        ints[i] = x;
                }


Reply via email to