本文整理汇总了C++中ustring::Rep::computedHash方法的典型用法代码示例。如果您正苦于以下问题:C++ Rep::computedHash方法的具体用法?C++ Rep::computedHash怎么用?C++ Rep::computedHash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ustring::Rep
的用法示例。
在下文中一共展示了Rep::computedHash方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: despecifyFunction
bool Structure::despecifyFunction(const Identifier& propertyName)
{
ASSERT(!propertyName.isNull());
materializePropertyMapIfNecessary();
if (!m_propertyTable)
return false;
UString::Rep* rep = propertyName._ustring.rep();
unsigned i = rep->computedHash();
#if DUMP_PROPERTYMAP_STATS
++numProbes;
#endif
unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
if (entryIndex == emptyEntryIndex)
return false;
if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
return true;
}
#if DUMP_PROPERTYMAP_STATS
++numCollisions;
#endif
unsigned k = 1 | doubleHash(rep->computedHash());
while (1) {
i += k;
#if DUMP_PROPERTYMAP_STATS
++numRehashes;
#endif
entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask];
if (entryIndex == emptyEntryIndex)
return false;
if (rep == m_propertyTable->entries()[entryIndex - 1].key) {
ASSERT(m_propertyTable->entries()[entryIndex - 1].specificValue);
m_propertyTable->entries()[entryIndex - 1].specificValue = 0;
return true;
}
}
}
示例2: createTable
void HashTable::createTable(JSGlobalData* globalData) const
{
#if ENABLE(PERFECT_HASH_SIZE)
ASSERT(!table);
HashEntry* entries = new HashEntry[hashSizeMask + 1];
for (int i = 0; i <= hashSizeMask; ++i)
entries[i].setKey(0);
for (int i = 0; values[i].key; ++i) {
UString::Rep* identifier = Identifier::add(globalData, values[i].key).releaseRef();
int hashIndex = identifier->computedHash() & hashSizeMask;
ASSERT(!entries[hashIndex].key());
entries[hashIndex].initialize(identifier, values[i].attributes, values[i].value1, values[i].value2);
}
table = entries;
#else
ASSERT(!table);
int linkIndex = compactHashSizeMask + 1;
HashEntry* entries = new HashEntry[compactSize];
for (int i = 0; i < compactSize; ++i)
entries[i].setKey(0);
for (int i = 0; values[i].key; ++i) {
UString::Rep* identifier = Identifier::add(globalData, values[i].key).releaseRef();
int hashIndex = identifier->computedHash() & compactHashSizeMask;
HashEntry* entry = &entries[hashIndex];
if (entry->key()) {
while (entry->next()) {
entry = entry->next();
}
ASSERT(linkIndex < compactSize);
entry->setNext(&entries[linkIndex++]);
entry = entry->next();
}
entry->initialize(identifier, values[i].attributes, values[i].value1, values[i].value2);
}
table = entries;
#endif
}
示例3: find
AtomicStringImpl* AtomicString::find(const KJS::Identifier& identifier)
{
if (identifier.isNull())
return 0;
UString::Rep* string = identifier.ustring().rep();
unsigned length = string->size();
if (!length)
return static_cast<AtomicStringImpl*>(StringImpl::empty());
HashAndCharacters buffer = { string->computedHash(), string->data(), length };
HashSet<StringImpl*>::iterator iterator = stringTable->find<HashAndCharacters, HashAndCharactersTranslator>(buffer);
if (iterator == stringTable->end())
return 0;
return static_cast<AtomicStringImpl*>(*iterator);
}
示例4: empty
PassRefPtr<StringImpl> AtomicString::add(const KJS::Identifier& identifier)
{
if (identifier.isNull())
return 0;
UString::Rep* string = identifier.ustring().rep();
unsigned length = string->size();
if (!length)
return StringImpl::empty();
HashAndCharacters buffer = { string->computedHash(), string->data(), length };
pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
if (!addResult.second)
return *addResult.first;
return adoptRef(*addResult.first);
}
示例5: createTable
void HashTable::createTable(JSGlobalData* globalData) const
{
ASSERT(!table);
HashEntry* entries = new HashEntry[hashSizeMask + 1];
for (int i = 0; i <= hashSizeMask; ++i)
entries[i].key = 0;
for (int i = 0; values[i].key; ++i) {
UString::Rep* identifier = Identifier::add(globalData, values[i].key).releaseRef();
int hashIndex = identifier->computedHash() & hashSizeMask;
ASSERT(!entries[hashIndex].key);
entries[hashIndex].key = identifier;
entries[hashIndex].integerValue = values[i].value;
entries[hashIndex].attributes = values[i].attributes;
entries[hashIndex].length = values[i].length;
}
table = entries;
}