ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/bzip2 CRC.java
Date Sat, 19 Jan 2002 23:56:24 GMT
donaldp     02/01/19 15:56:24

  Modified:    proposal/myrmidon/src/main/org/apache/tools/bzip2 CRC.java
  Log:
  Cleaned up class a little
  
  Revision  Changes    Path
  1.4       +14 -11    jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java
  
  Index: CRC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/bzip2/CRC.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CRC.java	23 Dec 2001 06:35:02 -0000	1.3
  +++ CRC.java	19 Jan 2002 23:56:24 -0000	1.4
  @@ -15,7 +15,8 @@
    */
   class CRC
   {
  -    public static int crc32Table[] = {
  +    private static int CRC32_TABLE[] = new int[]
  +    {
           0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
           0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
           0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
  @@ -82,39 +83,41 @@
           0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
       };
   
  -    int globalCrc;
  +    private int m_globalCrc;
   
  -    public CRC()
  +    protected CRC()
       {
           initialiseCRC();
       }
   
  -    void setGlobalCRC( int newCrc )
  +    void setGlobalCRC( final int newCrc )
       {
  -        globalCrc = newCrc;
  +        m_globalCrc = newCrc;
       }
   
       int getFinalCRC()
       {
  -        return ~globalCrc;
  +        return ~m_globalCrc;
       }
   
       int getGlobalCRC()
       {
  -        return globalCrc;
  +        return m_globalCrc;
       }
   
       void initialiseCRC()
       {
  -        globalCrc = 0xffffffff;
  +        m_globalCrc = 0xffffffff;
       }
   
  -    void updateCRC( int inCh )
  +    void updateCRC( final int inCh )
       {
  -        int temp = ( globalCrc >> 24 ) ^ inCh;
  +        int temp = ( m_globalCrc >> 24 ) ^ inCh;
           if( temp < 0 )
  +        {
               temp = 256 + temp;
  -        globalCrc = ( globalCrc << 8 ) ^ CRC.crc32Table[ temp ];
  +        }
  +        m_globalCrc = ( m_globalCrc << 8 ) ^ CRC32_TABLE[ temp ];
       }
   }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message