msvcp90: Add implementation of _Concurrent_vector_Internal_grow_to_at_least_with_result.

Signed-off-by: Hua Meng <161220092@smail.nju.edu.cn>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hua Meng 2018-08-02 23:38:39 +08:00 committed by Alexandre Julliard
parent 3feaa6bfa1
commit 2e54a47c98
1 changed files with 24 additions and 2 deletions

View File

@ -2133,8 +2133,30 @@ MSVCP_size_t __thiscall _Concurrent_vector_base_v4__Internal_grow_to_at_least_wi
_Concurrent_vector_base_v4 *this, MSVCP_size_t count, MSVCP_size_t element_size,
void (__cdecl *copy)(void*, const void*, MSVCP_size_t), const void *v)
{
FIXME("(%p %ld %ld %p %p) stub\n", this, count, element_size, copy, v);
return 0;
MSVCP_size_t size, seg_no, last_seg_no, remain_size;
TRACE("(%p %ld %ld %p %p)\n", this, count, element_size, copy, v);
_Concurrent_vector_base_v4__Internal_reserve(this, count, element_size,
MSVCP_SIZE_T_MAX / element_size);
do {
size = this->early_size;
if(size >= count) return size;
} while(InterlockedCompareExchangeSizeT(&this->early_size, count, size) != size);
seg_no = size ? _vector_base_v4__Segment_index_of(size - 1) : 0;
last_seg_no = _vector_base_v4__Segment_index_of(count - 1);
remain_size = min(count, 1 << (seg_no + 1)) - size;
if(remain_size > 0)
copy(((BYTE**)this->segment[seg_no] + element_size * (size - ((1 << seg_no) & ~1))), v,
remain_size);
if(seg_no != last_seg_no)
{
for(seg_no++; seg_no < last_seg_no; seg_no++)
copy(this->segment[seg_no], v, 1 << seg_no);
copy(this->segment[last_seg_no], v, count - (1 << last_seg_no));
}
return size;
}
/* ?_Internal_push_back@_Concurrent_vector_base_v4@details@Concurrency@@IAEPAXIAAI@Z */