git-svn-id: svn://db.shs.com.ru/pip@669 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2018-12-10 13:14:56 +00:00
parent 6117efd8a2
commit 3a9d885c29
7 changed files with 39 additions and 259 deletions

View File

@@ -235,13 +235,13 @@ public:
alloc(pid_size + 1, true);
if (index < pid_size - 1) {
size_t os = pid_size - index - 1;
memmove(&(pid_data[index + pid_start + 1]), &(pid_data[index + pid_start]), os * sizeof(T));
memmove((void*)(&(pid_data[index + pid_start + 1])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
}
} else {
alloc(pid_size + 1, false, -1);
//piCout << "insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove(&(pid_data[pid_start]), &(pid_data[pid_start + 1]), index * sizeof(T));
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + 1])), index * sizeof(T));
}
//piCout << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
PIINTROSPECTION_CONTAINER_USED(sizeof(T))
@@ -256,7 +256,7 @@ public:
ssize_t os = pid_size - index;
alloc(pid_size + other.pid_size, true);
if (os > 0)
memmove(&(pid_data[index + pid_start + other.pid_size]), &(pid_data[index + pid_start]), os * sizeof(T));
memmove((void*)(&(pid_data[index + pid_start + other.pid_size])), (const void*)(&(pid_data[index + pid_start])), os * sizeof(T));
} else {
//if (pid_start < other.pid_size) pid_start = 0;
//piCout << this << " insert offseted start ba" << pid_start << pid_size << pid_rsize;
@@ -264,7 +264,7 @@ public:
//piCout << this << " insert offseted start aa" << pid_start << pid_size << pid_rsize;
//piCout << this << " insert front" << pid_size << pid_rsize << pid_start << "!<";
if (index > 0)
memmove(&(pid_data[pid_start]), &(pid_data[pid_start + other.pid_size]), index * sizeof(T));
memmove((void*)(&(pid_data[pid_start])), (const void*)(&(pid_data[pid_start + other.pid_size])), index * sizeof(T));
}
//piCout << this << "insert" << pid_start << index << (pid_start + ssize_t(index)) << pid_size << ">!";
newT(pid_data + pid_start + index, other.pid_data + other.pid_start, other.pid_size);
@@ -281,9 +281,9 @@ public:
deleteT(&(pid_data[index + pid_start]), count);
if (os <= index) {
//if (true) {
if (os > 0) memmove(&(pid_data[index + pid_start]), &(pid_data[index + pid_start + count]), os * sizeof(T));
if (os > 0) memmove((void*)(&(pid_data[index + pid_start])), (const void*)(&(pid_data[index + pid_start + count])), os * sizeof(T));
} else {
if (index > 0) memmove(&(pid_data[pid_start + count]), &(pid_data[pid_start]), index * sizeof(T));
if (index > 0) memmove((void*)(&(pid_data[pid_start + count])), (const void*)(&(pid_data[pid_start])), index * sizeof(T));
pid_start += count;
}
pid_size -= count;
@@ -424,7 +424,7 @@ private:
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove(pid_data + ns, pid_data + pid_start, pid_size * sizeof(T));
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
}
@@ -433,7 +433,7 @@ private:
ssize_t ns = (pid_rsize - pid_size) / 2;
if (pid_start != ns) {
//printf("(%p) move %d -> %d\n", this, pid_start, ns);
memmove(pid_data + ns, pid_data + pid_start, pid_size * sizeof(T));
memmove((void*)(pid_data + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
pid_start = ns;
}
}
@@ -450,7 +450,7 @@ private:
if (as != pid_rsize) {
//printf("(%p) realloc %d -> %d (%p)\n", this, pid_rsize, as, pid_data);
PIINTROSPECTION_CONTAINER_ALLOC((as-pid_rsize)*sizeof(T))
T * p_d = (T*)(realloc(pid_data, as*sizeof(T)));
T * p_d = (T*)(realloc((void*)(pid_data), as*sizeof(T)));
assert(p_d);
pid_data = p_d;
pid_rsize = as;
@@ -473,7 +473,7 @@ private:
PIINTROSPECTION_CONTAINER_ALLOC((as-pid_rsize)*sizeof(T))
if (pid_rsize > 0 && pid_data != 0) {
//printf("%X copy from %p + %d to %p + %d %d el\n", this, pid_data, pid_start, td, ns, pid_size);
memcpy(td + ns, pid_data + pid_start, pid_size * sizeof(T));
memcpy((void*)(td + ns), (const void*)(pid_data + pid_start), pid_size * sizeof(T));
deleteRaw(pid_data);
}
pid_data = td;
@@ -495,7 +495,7 @@ private:
};
#define __PIDEQUE_SIMPLE_TYPE__(T) \
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(s*sizeof(T)); memcpy(dst, src, s * sizeof(T));} \
template<> inline void PIDeque<T>::newT(T * dst, const T * src, size_t s) {PIINTROSPECTION_CONTAINER_USED(s*sizeof(T)); memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIDeque<T>::deleteT(T * d, size_t sz) {PIINTROSPECTION_CONTAINER_UNUSED(sz*sizeof(T));} \
template<> inline void PIDeque<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIDeque<T>::elementDelete(T & from) {;} \

View File

@@ -228,7 +228,7 @@ public:
alloc(piv_size + 1);
if (index < piv_size - 1) {
size_t os = piv_size - index - 1;
memmove(&(piv_data[index + 1]), &(piv_data[index]), os * sizeof(T));
memmove((void*)(&(piv_data[index + 1])), (const void*)(&(piv_data[index])), os * sizeof(T));
}
//zeroRaw(&(piv_data[index]), 1);
elementNew(piv_data + index, v);
@@ -239,7 +239,7 @@ public:
ssize_t os = piv_size - index;
alloc(piv_size + other.piv_size);
if (os > 0)
memmove(&(piv_data[index + other.piv_size]), &(piv_data[index]), os * sizeof(T));
memmove((void*)(&(piv_data[index + other.piv_size])), (const void*)(&(piv_data[index])), os * sizeof(T));
newT(piv_data + index, other.piv_data, other.piv_size);
return *this;
}
@@ -252,7 +252,7 @@ public:
}
size_t os = piv_size - index - count;
deleteT(&(piv_data[index]), count);
memmove(&(piv_data[index]), &(piv_data[index + count]), os * sizeof(T));
memmove((void*)(&(piv_data[index])), (const void*)(&(piv_data[index + count])), os * sizeof(T));
piv_size -= count;
return *this;
}
@@ -360,7 +360,7 @@ private:
if (as == piv_rsize) return;
//cout << std::hex << " ![("<<this<<")realloc " << piv_data << " data ... <\n" << endl;
T * p_d = (T*)(realloc(piv_data, as*sizeof(T)));
T * p_d = (T*)(realloc((void*)(piv_data), as*sizeof(T)));
assert(p_d);
piv_data = p_d;
//zeroRaw(&(piv_data[os]), as - os);
@@ -432,7 +432,7 @@ __PIVECTOR_SIMPLE_FUNCTIONS__(float)
__PIVECTOR_SIMPLE_FUNCTIONS__(double)
__PIVECTOR_SIMPLE_FUNCTIONS__(ldouble)*/
#define __PIVECTOR_SIMPLE_TYPE__(T) \
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {memcpy(dst, src, s * sizeof(T));} \
template<> inline void PIVector<T>::newT(T * dst, const T * src, size_t s) {memcpy((void*)(dst), (const void*)(src), s * sizeof(T));} \
template<> inline void PIVector<T>::deleteT(T * d, size_t sz) {;} \
template<> inline void PIVector<T>::elementNew(T * to, const T & from) {(*to) = from;} \
template<> inline void PIVector<T>::elementDelete(T & from) {;} \