亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qhash.cpp

?? QT 開發環境里面一個很重要的文件
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/******************************************************************************** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://www.trolltech.com/products/qt/opensource.html**** If you are unsure which license is appropriate for your use, please** review the following information:** http://www.trolltech.com/products/qt/licensing.html or contact the** sales department at sales@trolltech.com.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qhash.h"#ifdef truncate#undef truncate#endif#include <qbytearray.h>#include <qstring.h>#include <stdlib.h>/*    These functions are based on Peter J. Weinberger's hash function    (from the Dragon Book). The constant 24 in the original function    was replaced with 23 to produce fewer collisions on input such as    "a", "aa", "aaa", "aaaa", ...*/uint qHash(const QByteArray &key){    const uchar *p = reinterpret_cast<const uchar *>(key.data());    int n = key.size();    uint h = 0;    uint g;    while (n--) {        h = (h << 4) + *p++;        if ((g = (h & 0xf0000000)) != 0)            h ^= g >> 23;        h &= ~g;    }    return h;}uint qHash(const QString &key){    const QChar *p = key.unicode();    int n = key.size();    uint h = 0;    uint g;    while (n--) {        h = (h << 4) + (*p++).unicode();        if ((g = (h & 0xf0000000)) != 0)            h ^= g >> 23;        h &= ~g;    }    return h;}/*    The prime_deltas array is a table of selected prime values, even    though it doesn't look like one. The primes we are using are 1,    2, 5, 11, 17, 37, 67, 131, 257, ..., i.e. primes in the immediate    surrounding of a power of two.    The primeForNumBits() function returns the prime associated to a    power of two. For example, primeForNumBits(8) returns 257.*/static const uchar prime_deltas[] = {    0,  0,  1,  3,  1,  5,  3,  3,  1,  9,  7,  5,  3,  9, 25,  3,    1, 21,  3, 21,  7, 15,  9,  5,  3, 29, 15,  0,  0,  0,  0,  0};static inline int primeForNumBits(int numBits){    return (1 << numBits) + prime_deltas[numBits];}/*    Returns the smallest integer n such that    primeForNumBits(n) >= hint.*/static int countBits(int hint){    int numBits = 0;    int bits = hint;    while (bits > 1) {        bits >>= 1;        numBits++;    }    if (numBits >= (int)sizeof(prime_deltas)) {        numBits = sizeof(prime_deltas) - 1;    } else if (primeForNumBits(numBits) < hint) {        ++numBits;    }    return numBits;}/*    A QHash has initially around pow(2, MinNumBits) buckets. For    example, if MinNumBits is 4, it has 17 buckets.*/const int MinNumBits = 4;QHashData QHashData::shared_null = {    0, 0, Q_ATOMIC_INIT(1), 0, 0, MinNumBits, 0, 0, true};void *QHashData::allocateNode(){    return ::malloc(nodeSize);}void QHashData::freeNode(void *node){    ::free(node);}QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *), int nodeSize){    union {        QHashData *d;        Node *e;    };    d = new QHashData;    d->fakeNext = 0;    d->buckets = 0;    d->ref.init(1);    d->size = size;    d->nodeSize = nodeSize;    d->userNumBits = userNumBits;    d->numBits = numBits;    d->numBuckets = numBuckets;    d->sharable = true;    if (numBuckets) {        d->buckets = new Node *[numBuckets];        Node *this_e = reinterpret_cast<Node *>(this);        for (int i = 0; i < numBuckets; ++i) {            Node **nextNode = &d->buckets[i];            Node *oldNode = buckets[i];            while (oldNode != this_e) {                Node *dup = static_cast<Node *>(allocateNode());                node_duplicate(oldNode, dup);                dup->h = oldNode->h;                *nextNode = dup;                nextNode = &dup->next;                oldNode = oldNode->next;            }            *nextNode = e;        }    }    return d;}QHashData::Node *QHashData::nextNode(Node *node){    union {        Node *next;        Node *e;        QHashData *d;    };    next = node->next;    Q_ASSERT_X(next, "QHash", "Iterating beyond end()");    if (next->next)        return next;    int start = (node->h % d->numBuckets) + 1;    Node **bucket = d->buckets + start;    int n = d->numBuckets - start;    while (n--) {        if (*bucket != e)            return *bucket;        ++bucket;    }    return e;}QHashData::Node *QHashData::previousNode(Node *node){    union {        Node *e;        QHashData *d;    };    e = node;    while (e->next)        e = e->next;    int start;    if (node == e)        start = d->numBuckets - 1;    else        start = node->h % d->numBuckets;    Node *sentinel = node;    Node **bucket = d->buckets + start;    while (start >= 0) {        if (*bucket != sentinel) {            Node *prev = *bucket;            while (prev->next != sentinel)                prev = prev->next;            return prev;        }        sentinel = e;        --bucket;        --start;    }    Q_ASSERT_X(start >= 0, "QHash", "Iterating backward beyond begin()");    return e;}/*    If hint is negative, -hint gives the approximate number of    buckets that should be used for the hash table. If hint is    nonnegative, (1 << hint) gives the approximate number    of buckets that should be used.*/void QHashData::rehash(int hint){    if (hint < 0) {        hint = countBits(-hint);        if (hint < MinNumBits)            hint = MinNumBits;        userNumBits = hint;        while (primeForNumBits(hint) < (size >> 1))            ++hint;    } else if (hint < MinNumBits) {        hint = MinNumBits;    }    if (numBits != hint) {        Node *e = reinterpret_cast<Node *>(this);        Node **oldBuckets = buckets;        int oldNumBuckets = numBuckets;        numBits = hint;        numBuckets = primeForNumBits(hint);        buckets = new Node *[numBuckets];        for (int i = 0; i < numBuckets; ++i)            buckets[i] = e;        for (int i = 0; i < oldNumBuckets; ++i) {            Node *firstNode = oldBuckets[i];            while (firstNode != e) {                uint h = firstNode->h;                Node *lastNode = firstNode;                while (lastNode->next != e && lastNode->next->h == h)                    lastNode = lastNode->next;                Node *afterLastNode = lastNode->next;                Node **beforeFirstNode = &buckets[h % numBuckets];                while (*beforeFirstNode != e)                    beforeFirstNode = &(*beforeFirstNode)->next;                lastNode->next = *beforeFirstNode;                *beforeFirstNode = firstNode;                firstNode = afterLastNode;            }        }        delete [] oldBuckets;    }}void QHashData::destroyAndFree(){    delete [] buckets;    delete this;}#ifdef QT_QHASH_DEBUG#include <qstring.h>void QHashData::dump(){    qDebug("Hash data (ref = %d, size = %d, nodeSize = %d, userNumBits = %d, numBits = %d, numBuckets = %d)",            int(ref), size, nodeSize, userNumBits, numBits,            numBuckets);    qDebug("    %p (fakeNode = %p)", this, fakeNext);    for (int i = 0; i < numBuckets; ++i) {        QString line;        Node *n = buckets[i];        if (n != reinterpret_cast<Node *>(this)) {            line.sprintf("%d:", i);            while (n != reinterpret_cast<Node *>(this)) {                line += QString().sprintf(" -> [%p]", n);                if (!n) {                    line += " (CORRUPT)";                    break;                }                n = n->next;            }            qDebug(qPrintable(line));        }    }}void QHashData::checkSanity(){    if (fakeNext)        qFatal("Fake next isn't 0");    for (int i = 0; i < numBuckets; ++i) {        Node *n = buckets[i];        Node *p = n;        if (!n)            qFatal("%d: Bucket entry is 0", i);        if (n != reinterpret_cast<Node *>(this)) {            while (n != reinterpret_cast<Node *>(this)) {                if (!n->next)                    qFatal("%d: Next of %p is 0, should be %p", i, n, this);                n = n->next;            }        }    }}#endif/*!    \class QHash    \brief The QHash class is a template class that provides a hash-table-based dictionary.    \ingroup tools    \ingroup shared    \mainclass    \reentrant    QHash\<Key, T\> is one of Qt's generic \l{container classes}. It    stores (key, value) pairs and provides very fast lookup of the    value associated with a key.    QHash provides very similar functionality to QMap. The    differences are:    \list    \i QHash provides faster lookups than QMap. (See \l{Algorithmic       Complexity} for details.)    \i When iterating over a QMap, the items are always sorted by       key. With QHash, the items are arbitrarily ordered.    \i The key type of a QMap must provide operator<(). The key       type of a QHash must provide operator==() and a global       \l{qHash()}{qHash}(Key) function.    \endlist    Here's an example QHash with QString keys and \c int values:    \code        QHash<QString, int> hash;    \endcode    To insert a (key, value) pair into the hash, you can use operator[]():    \code        hash["one"] = 1;        hash["three"] = 3;        hash["seven"] = 7;    \endcode    This inserts the following three (key, value) pairs into the    QHash: ("one", 1), ("three", 3), and ("seven", 7). Another way to    insert items into the hash is to use insert():    \code        hash.insert("twelve", 12);    \endcode    To look up a value, use operator[]() or value():    \code        int num1 = hash["thirteen"];        int num2 = hash.value("thirteen");    \endcode    If there is no item with the specified key in the hash, these    functions return a \l{default-constructed value}.    If you want to check whether the hash contains a particular key,    use contains():    \code        int timeout = 30;        if (hash.contains("TIMEOUT"))            timeout = hash.value("TIMEOUT");    \endcode    There is also a value() overload that uses its second argument as    a default value if there is no item with the specified key:    \code        int timeout = hash.value("TIMEOUT", 30);    \endcode    In general, we recommend that you use contains() and value()    rather than operator[]() for looking up a key in a hash. The    reason is that operator[]() silently inserts an item into the    hash if no item exists with the same key (unless the hash is    const). For example, the following code snippet will create 1000    items in memory:    \code        // WRONG        QHash<int, QWidget *> hash;        ...        for (int i = 0; i < 1000; ++i) {            if (hash[i] == okButton)                cout << "Found button at index " << i << endl;        }    \endcode    To avoid this problem, replace \c hash[i] with \c hash.value(i)    in the code above.    If you want to navigate through all the (key, value) pairs stored    in a QHash, you can use an iterator. QHash provides both    \l{Java-style iterators} (QHashIterator and QMutableHashIterator)    and \l{STL-style iterators} (QHash::const_iterator and    QHash::iterator). Here's how to iterate over a QHash<QString,    int> using a Java-style iterator:    \code        QHashIterator<QString, int> i(hash);        while (i.hasNext()) {            i.next();            cout << i.key() << ": " << i.value() << endl;        }    \endcode    Here's the same code, but using an STL-style iterator:    \code        QHash<QString, int>::const_iterator i = hash.constBegin();        while (i != hash.constEnd()) {            cout << i.key() << ": " << i.value() << endl;            ++i;        }    \endcode    QHash is unordered, so an iterator's sequence cannot be assumed    to be predictable. If ordering by key is required, use a QMap.    Normally, a QHash allows only one value per key. If you call    insert() with a key that already exists in the QHash, the    previous value is erased. For example:    \code        hash.insert("plenty", 100);        hash.insert("plenty", 2000);        // hash.value("plenty") == 2000

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人激情小说网站| 国产精品白丝jk黑袜喷水| 91久久国产最好的精华液| 亚洲男人的天堂在线观看| 99国产精品久久| 亚洲高清免费一级二级三级| 欧美日韩一区二区在线视频| 免费观看在线综合色| 精品成人一区二区三区四区| 懂色av中文一区二区三区| 国产精品成人网| 欧美亚洲一区三区| 麻豆精品新av中文字幕| 国产午夜精品在线观看| 色婷婷一区二区| 美脚の诱脚舐め脚责91| 亚洲国产精品成人综合 | 久久爱www久久做| 久久影院电视剧免费观看| 暴力调教一区二区三区| 夜夜嗨av一区二区三区四季av| 69av一区二区三区| 成人午夜激情在线| 日韩国产欧美视频| 日本一区二区三区在线不卡| 欧美在线免费播放| 久久99国产精品成人| 1000精品久久久久久久久| 欧美日韩精品三区| 国产成人免费视| 亚洲电影欧美电影有声小说| 国产视频在线观看一区二区三区| 在线看日本不卡| 国产成人免费视频网站高清观看视频| 亚洲午夜三级在线| 久久久久九九视频| 欧美网站一区二区| 丁香一区二区三区| 免费观看在线综合| 亚洲一区二区精品视频| 国产精品视频一二三| 欧美精品v国产精品v日韩精品| 成人国产精品视频| 麻豆精品视频在线观看免费| 一区二区不卡在线播放 | 在线视频你懂得一区二区三区| 麻豆精品在线观看| 亚洲第四色夜色| 亚洲女人小视频在线观看| 欧美精品一区二区三区久久久 | 美女视频黄频大全不卡视频在线播放| 综合自拍亚洲综合图不卡区| 久久人人97超碰com| 欧美一级黄色录像| 欧美久久一二三四区| 色综合夜色一区| 欧美一级欧美三级在线观看| 99精品欧美一区二区三区小说| 看电影不卡的网站| 亚洲成人av在线电影| 亚洲色图一区二区| 国产精品美女久久久久久久网站| 欧美tickle裸体挠脚心vk| 欧美色图免费看| 色婷婷亚洲精品| 一本到一区二区三区| 99re热视频精品| 不卡高清视频专区| 成人黄色在线视频| 国产91精品精华液一区二区三区 | av中文字幕不卡| 国产在线不卡一区| 国产老妇另类xxxxx| 精品在线亚洲视频| 麻豆精品视频在线观看免费 | 国产欧美日韩在线视频| 精品国产免费视频| 精品成人一区二区三区| 久久久久青草大香线综合精品| 欧美成va人片在线观看| 日韩欧美黄色影院| 2023国产精品| 欧美国产乱子伦 | 波多野结衣在线aⅴ中文字幕不卡| 国产成人精品1024| 国产成人一区在线| 91色九色蝌蚪| 欧美亚洲国产一区二区三区va| 欧美亚洲动漫制服丝袜| 在线不卡欧美精品一区二区三区| 欧美日韩久久久久久| 欧美一区二区三区喷汁尤物| 日韩精品一区二区三区中文不卡 | 精品一区二区在线看| 国产精品一区二区三区乱码| 国产成人av资源| 91理论电影在线观看| 欧美色图12p| 日韩欧美在线1卡| 国产视频911| 亚洲女厕所小便bbb| 日本伊人午夜精品| 精品亚洲aⅴ乱码一区二区三区| 岛国av在线一区| 在线观看中文字幕不卡| 91精品久久久久久久99蜜桃| 国产三级三级三级精品8ⅰ区| 国产精品久久久久久久久搜平片| 亚洲综合小说图片| 久久精品国产77777蜜臀| 国产成人aaa| 欧美日韩一区二区三区视频| 欧美成人精品1314www| 国产精品嫩草影院com| 亚洲成人动漫一区| 丰满岳乱妇一区二区三区| 在线观看视频一区二区欧美日韩| 精品入口麻豆88视频| 亚洲欧美日韩国产手机在线 | 视频一区免费在线观看| 国产精品中文欧美| 欧洲亚洲国产日韩| 国产亚洲欧美日韩在线一区| 亚洲资源中文字幕| 国产一区二区调教| 欧美日韩一区二区三区免费看| 国产三区在线成人av| 日韩精品一级二级| 成人av影视在线观看| 欧美一区二区久久| 亚洲人成小说网站色在线| 精品亚洲国产成人av制服丝袜| 在线视频综合导航| 国产亚洲欧美激情| 麻豆91在线看| 欧美日韩一区成人| 最近日韩中文字幕| 国产成人综合亚洲网站| 91精品国产一区二区人妖| 一区二区视频免费在线观看| 国产精品亚洲午夜一区二区三区| 欧美疯狂性受xxxxx喷水图片| 中文字幕在线免费不卡| 国产精品影视天天线| 日韩视频一区二区三区| 亚洲国产精品尤物yw在线观看| 91污在线观看| 国产婷婷色一区二区三区在线| 久久国产视频网| 欧美一区二区精美| 日日噜噜夜夜狠狠视频欧美人| 91免费视频观看| 日韩美女精品在线| 成人一区二区三区中文字幕| 久久嫩草精品久久久久| 老司机免费视频一区二区| 欧美疯狂做受xxxx富婆| 亚洲国产一区二区a毛片| 色婷婷久久久亚洲一区二区三区| 国产精品久久二区二区| 成人黄色在线视频| 国产精品入口麻豆原神| 国产精品系列在线播放| 国产欧美一区二区精品久导航 | 欧美人成免费网站| 亚洲第一福利视频在线| 欧美三区在线视频| 五月婷婷欧美视频| 欧美欧美欧美欧美首页| 亚洲成人免费观看| 欧美日韩国产在线观看| 日韩影院精彩在线| 日韩片之四级片| 精品一区二区三区在线观看国产| 欧美va在线播放| 国产精品99久久久| 中文字幕一区在线观看| 一本久久精品一区二区| 亚洲一区二区高清| 日韩一区二区在线播放| 国产在线精品免费| 中文字幕乱码亚洲精品一区| 色综合天天视频在线观看 | 久久99深爱久久99精品| 久久综合av免费| 成人激情动漫在线观看| 一区二区三区四区在线| 欧美区视频在线观看| 久久精品噜噜噜成人88aⅴ| 久久久91精品国产一区二区精品 | 九色综合狠狠综合久久| 日本一区免费视频| 在线免费视频一区二区| 毛片不卡一区二区| 国产精品久久综合| 欧美特级限制片免费在线观看| 久久爱另类一区二区小说| 中文字幕av一区二区三区高| 在线观看精品一区| 精品亚洲免费视频|