src/corelib/tools/qhash.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     8 **
     8 **
    66     uint h = 0;
    66     uint h = 0;
    67     uint g;
    67     uint g;
    68 
    68 
    69     while (n--) {
    69     while (n--) {
    70         h = (h << 4) + *p++;
    70         h = (h << 4) + *p++;
    71         if ((g = (h & 0xf0000000)) != 0)
    71         g = h & 0xf0000000;
    72             h ^= g >> 23;
    72         h ^= g >> 23;
    73         h &= ~g;
    73         h &= ~g;
    74     }
    74     }
    75     return h;
    75     return h;
    76 }
    76 }
    77 
    77 
    80     uint h = 0;
    80     uint h = 0;
    81     uint g;
    81     uint g;
    82 
    82 
    83     while (n--) {
    83     while (n--) {
    84         h = (h << 4) + (*p++).unicode();
    84         h = (h << 4) + (*p++).unicode();
    85         if ((g = (h & 0xf0000000)) != 0)
    85         g = h & 0xf0000000;
    86             h ^= g >> 23;
    86         h ^= g >> 23;
    87         h &= ~g;
    87         h &= ~g;
    88     }
    88     }
    89     return h;
    89     return h;
    90 }
    90 }
    91 
    91