[Webfunds-commits] java/webfunds/sox Utils.java

Ian Grigg iang@cypherpunks.ai
Thu, 30 Nov 2000 09:45:12 -0400 (AST)


iang        00/11/30 09:45:12

  Modified:    webfunds/sox Utils.java
  Log:
  exampleLong bug resulted in mostly negatives;  now fixed, and also
  now biased to low numbers rather than big numbers

Revision  Changes    Path
1.20      +4 -4      java/webfunds/sox/Utils.java

Index: Utils.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Utils.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Utils.java	2000/08/30 02:12:41	1.19
+++ Utils.java	2000/11/30 13:45:12	1.20
@@ -1,5 +1,5 @@
 /*
- * $Id: Utils.java,v 1.19 2000/08/30 02:12:41 gelderen Exp $
+ * $Id: Utils.java,v 1.20 2000/11/30 13:45:12 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -143,10 +143,10 @@
     public static long exampleLong()
     {
         long l = 0;
-        for (int i = 7; i >=0; i--)
-        {
+        for (int i = (exampleByte() & 0x07); i >=0; i--)
+        {            // kilted towards low numbers
             l <<= 8;
-            l |= exampleByte();
+            l |= exampleByte() & 0xFF;
         }
         return l ;
     }