本文整理汇总了C++中ZendArray::find方法的典型用法代码示例。如果您正苦于以下问题:C++ ZendArray::find方法的具体用法?C++ ZendArray::find怎么用?C++ ZendArray::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZendArray
的用法示例。
在下文中一共展示了ZendArray::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LIKELY
inline ALWAYS_INLINE ZendArray *ZendArray::copyImplHelper(bool sma) const {
ZendArray *target = LIKELY(sma) ? NEW(ZendArray)(m_size)
: new ZendArray(m_size);
Bucket *last = NULL;
for (Bucket *p = m_pListHead; p; p = p->pListNext) {
Bucket *np = LIKELY(sma) ? NEW(Bucket)(Variant::noInit)
: new Bucket(Variant::noInit);
np->data.constructWithRefHelper(p->data, this);
uint nIndex;
if (p->hasStrKey()) {
np->setStrKey(p->skey, p->hash());
nIndex = p->hash() & target->m_nTableMask;
} else {
np->setIntKey(p->ikey);
nIndex = p->ikey & target->m_nTableMask;
}
np->pNext = target->m_arBuckets[nIndex];
target->m_arBuckets[nIndex] = np;
if (last) {
last->pListNext = np;
np->pListLast = last;
} else {
target->m_pListHead = np;
np->pListLast = NULL;
}
last = np;
}
if (last) last->pListNext = NULL;
target->m_pListTail = last;
target->m_size = m_size;
target->m_nNextFreeElement = m_nNextFreeElement;
Bucket *p = reinterpret_cast<Bucket *>(m_pos);
if (p == NULL) {
target->m_pos = (ssize_t)0;
} else if (p == m_pListHead) {
target->m_pos = (ssize_t)target->m_pListHead;
} else {
if (p->hasStrKey()) {
target->m_pos = (ssize_t)target->find(p->skey->data(),
p->skey->size(),
(int64)p->hash());
} else {
target->m_pos = (ssize_t)target->find((int64)p->ikey);
}
}
return target;
}
示例2: NEW
ZendArray *ZendArray::copyImpl() const {
ZendArray *target = NEW(ZendArray)(m_nNumOfElements);
Bucket *last = NULL;
for (Bucket *p = m_pListHead; p; p = p->pListNext) {
Bucket *np = NEW(Bucket)(Variant::noInit);
np->data.constructWithRefHelper(p->data, this);
np->h = p->h;
if (p->key) {
np->key = p->key;
np->key->incRefCount();
}
uint nIndex = (p->h & target->m_nTableMask);
np->pNext = target->m_arBuckets[nIndex];
target->m_arBuckets[nIndex] = np;
if (last) {
last->pListNext = np;
np->pListLast = last;
} else {
target->m_pListHead = np;
np->pListLast = NULL;
}
last = np;
}
if (last) last->pListNext = NULL;
target->m_pListTail = last;
target->m_nNumOfElements = m_nNumOfElements;
target->m_nNextFreeElement = m_nNextFreeElement;
Bucket *p = reinterpret_cast<Bucket *>(m_pos);
if (p == NULL) {
target->m_pos = (ssize_t)0;
} else if (p == m_pListHead) {
target->m_pos = (ssize_t)target->m_pListHead;
} else {
if (p->key) {
target->m_pos = (ssize_t)target->find(p->key->data(),
p->key->size(),
(int64)p->h);
} else {
target->m_pos = (ssize_t)target->find((int64)p->h);
}
}
return target;
}