亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲mv在线观看| 精品人在线二区三区| 《视频一区视频二区| 日韩欧美亚洲国产另类| 91电影在线观看| 91麻豆国产自产在线观看| 久久成人久久爱| 青青草国产成人av片免费| 亚洲欧美成aⅴ人在线观看| 7777精品伊人久久久大香线蕉经典版下载 | 一区视频在线播放| 久久亚洲精精品中文字幕早川悠里| 欧美日韩久久久一区| 色噜噜狠狠色综合中国| 99在线热播精品免费| 国产成人综合网站| 国产高清精品网站| 国产精品亚洲成人| 久久精品国产澳门| 日韩有码一区二区三区| 午夜免费欧美电影| 日韩成人伦理电影在线观看| 丝袜a∨在线一区二区三区不卡| 亚洲午夜免费福利视频| 国产精品久久毛片a| 国产精品久久久久9999吃药| 日韩一二三四区| 日韩一级片在线观看| 日本乱人伦aⅴ精品| 色综合久久久久网| 91一区一区三区| 欧美久久久久久蜜桃| 日韩色在线观看| 久久久久久电影| 亚洲欧洲日产国产综合网| 亚洲国产一区二区三区| 国产精品高潮呻吟久久| 亚洲视频在线一区观看| 亚洲精品乱码久久久久久黑人| 国产精品成人午夜| 亚洲永久精品国产| 麻豆国产欧美日韩综合精品二区| 久久99九九99精品| 91麻豆免费看| 欧美日韩亚洲另类| 欧美日韩成人一区| 久久精品一区二区| 亚洲精品国产a| 日韩福利电影在线| 成人在线综合网| 欧美日韩情趣电影| 中文字幕免费一区| 五月婷婷色综合| 99综合影院在线| 9191精品国产综合久久久久久| 欧美va亚洲va| 一区二区三区在线观看欧美| 久久99精品国产麻豆婷婷洗澡| 波波电影院一区二区三区| 6080国产精品一区二区| 国产精品乱人伦中文| 麻豆一区二区三| 欧美在线free| 久久综合九色综合欧美就去吻| 久久久.com| 美女视频黄免费的久久 | 国产综合一区二区| 91亚洲精品一区二区乱码| 日韩精品资源二区在线| 亚洲美女一区二区三区| 成人免费黄色在线| 久久夜色精品国产欧美乱极品| 亚洲青青青在线视频| 久久国产精品99精品国产| 欧美性猛交xxxx黑人交| 亚洲国产精品ⅴa在线观看| 日本vs亚洲vs韩国一区三区| 色婷婷av一区二区三区软件| 欧美国产激情二区三区| 日韩一区欧美二区| 91在线无精精品入口| 日韩欧美不卡一区| 天堂资源在线中文精品| 北岛玲一区二区三区四区| 精品1区2区在线观看| 精品亚洲aⅴ乱码一区二区三区| 欧美人妇做爰xxxⅹ性高电影| 一区二区三区欧美激情| 色婷婷av一区二区三区gif| 久久精品网站免费观看| 国产一区二区三区免费看| 久久伊人蜜桃av一区二区| 国产一区欧美二区| 国产欧美一区二区精品久导航| 经典三级在线一区| 欧美丰满高潮xxxx喷水动漫| 欧美国产欧美综合| www.久久久久久久久| **欧美大码日韩| 国产成人自拍网| 91麻豆精品91久久久久同性| 午夜电影网一区| 欧美一区二区三区公司| 婷婷综合五月天| 欧美顶级少妇做爰| 黑人精品欧美一区二区蜜桃| 欧美国产精品专区| 色综合天天在线| 亚洲成人激情综合网| 欧美少妇一区二区| 日韩高清在线不卡| 欧美日韩三级一区| 婷婷综合五月天| 国产人久久人人人人爽| 色欲综合视频天天天| 日韩国产欧美在线视频| 久久久另类综合| 91福利视频久久久久| 日韩国产精品久久| 国产片一区二区| 不卡一区二区中文字幕| 午夜精品久久久久久久99水蜜桃| 久久综合色婷婷| 欧美性生交片4| 亚洲va国产天堂va久久en| 欧美精品一区二区三区久久久| 国产.精品.日韩.另类.中文.在线.播放 | 日韩美女一区二区三区| 国产成a人无v码亚洲福利| 玉米视频成人免费看| 91精品国产日韩91久久久久久| 国产成人午夜精品影院观看视频| 亚洲一区二区在线视频| 久久免费视频色| 欧美日韩亚洲另类| 99re成人精品视频| 久久国产尿小便嘘嘘尿| 亚洲综合精品自拍| 久久精品欧美日韩| 欧美日韩五月天| 色婷婷综合久久久久中文一区二区 | 日韩精品专区在线影院观看| 91麻豆成人久久精品二区三区| 黑人精品欧美一区二区蜜桃 | 91精品1区2区| 国产剧情av麻豆香蕉精品| 午夜在线成人av| 亚洲视频一二区| 国产欧美精品一区二区色综合| 欧美一区二区三区电影| 欧美日韩高清影院| 91搞黄在线观看| 91在线视频播放| 国产.欧美.日韩| 久久成人免费电影| 国内精品视频666| 久久超级碰视频| 日精品一区二区三区| 亚洲一二三四区不卡| 亚洲男人都懂的| 亚洲人成7777| 亚洲欧美偷拍另类a∨色屁股| 国产精品伦一区二区三级视频| 国产日韩欧美一区二区三区综合| 欧美一区二区三区在线电影| 555夜色666亚洲国产免| 色欧美乱欧美15图片| zzijzzij亚洲日本少妇熟睡| 国产一区二区三区不卡在线观看| 久久99国产精品久久| 麻豆91在线播放| 狠狠色丁香久久婷婷综合丁香| 国内久久精品视频| 国产综合色在线视频区| 国产激情视频一区二区在线观看| 国产一区在线看| jizz一区二区| 日本二三区不卡| 欧美日韩一区中文字幕| 欧美肥妇bbw| 精品国产免费一区二区三区四区 | 美女网站一区二区| 精品一二线国产| 国内不卡的二区三区中文字幕| 国产成人免费在线观看不卡| 蜜乳av一区二区三区| 精品一区二区在线看| 国产精品69久久久久水密桃| 成a人片亚洲日本久久| 欧美中文字幕一区| 日韩视频一区二区三区在线播放 | 久久成人av少妇免费| 国产一区不卡视频| 99久久精品国产精品久久| 欧美日韩中文字幕一区二区| 在线播放中文字幕一区| 国产欧美日韩另类一区| 性做久久久久久免费观看 | 免费欧美在线视频| 国产高清一区日本|