Changeset 4922


Ignore:
Timestamp:
11/30/03 06:17:01 (18 years ago)
Author:
piso
Message:

hashCode()

Location:
trunk/j/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/BitVector.java

    r4617 r4922  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: BitVector.java,v 1.26 2003-11-02 20:54:36 piso Exp $
     5 * $Id: BitVector.java,v 1.27 2003-11-30 06:12:43 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    289289    }
    290290
     291    public int hashCode()
     292    {
     293        int hashCode = 1;
     294        // Consider first 64 bits only.
     295        final int limit = Math.min(length(), 64);
     296        for (int i = 0; i < limit; i++)
     297            hashCode = 31 * hashCode + _get(i);
     298        return hashCode;
     299    }
     300
    291301    public String toString()
    292302    {
  • trunk/j/src/org/armedbear/lisp/LispString.java

    r4726 r4922  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispString.java,v 1.64 2003-11-14 00:53:57 piso Exp $
     5 * $Id: LispString.java,v 1.65 2003-11-30 06:17:01 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    317317            return cachedHashCode;
    318318        int hashCode = 0;
    319         final int limit = array.length;
     319        final int limit = length();
    320320        for (int i = 0; i < limit; i++)
    321321            hashCode = hashCode * 31 + array[i];
Note: See TracChangeset for help on using the changeset viewer.