Changeset 82cbf8c6 in mainline for kernel/generic/include/adt/hash.h


Ignore:
Timestamp:
2017-10-08T19:37:24Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fd26bb
Parents:
81b9d3e
Message:

Replace the old hash table implementation in the kernel with the newer one

This replaces the original hash table implementation with the resizable one
already used in uspace. Along the way, the IRQ hash table code was streamlined
and cleaned up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/adt/hash.h

    r81b9d3e r82cbf8c6  
    4545         * Public domain.
    4646         */
    47         hash = ~hash + (hash << 15); 
     47        hash = ~hash + (hash << 15);
    4848        hash = hash ^ (hash >> 12);
    4949        hash = hash + (hash << 2);
    5050        hash = hash ^ (hash >> 4);
    51         hash = hash * 2057; 
     51        hash = hash * 2057;
    5252        hash = hash ^ (hash >> 16);
    53         return hash;   
     53        return hash;
    5454}
    5555
     
    6565        hash = hash ^ (hash >> 4);
    6666        hash = hash * 0x27d4eb2d;
    67         hash = hash ^ (hash >> 15);     
    68         /* 
     67        hash = hash ^ (hash >> 15);
     68        /*
    6969         * Lower order bits are mixed more thoroughly. Swap them with
    7070         * the higher order bits and make the resulting higher order bits
     
    105105         * http://burtleburtle.net/bob/c/lookup3.c
    106106         */
    107         seed ^= hash + 0x9e3779b9 
     107        seed ^= hash + 0x9e3779b9
    108108                + ((seed << 5) | (seed >> (sizeof(size_t) * 8 - 5)));
    109         return seed;   
     109        return seed;
    110110}
    111111
Note: See TracChangeset for help on using the changeset viewer.