get rid of piForeach
apply some code analyzer recommendations ICU flag now check if libicu exists prepare for more accurate growth of containers (limited PoT, then constantly increase size)
This commit is contained in:
@@ -19,8 +19,11 @@
|
||||
|
||||
#include "picontainers.h"
|
||||
|
||||
#include "piliterals_bytes.h"
|
||||
|
||||
const size_t minAlloc = 64;
|
||||
|
||||
const size_t minAlloc = 64;
|
||||
const size_t maxPoTAlloc = 4_MiB;
|
||||
|
||||
|
||||
size_t _PIContainerConstantsBase::calcMinCountPoT(size_t szof) {
|
||||
@@ -33,3 +36,13 @@ size_t _PIContainerConstantsBase::calcMinCountPoT(size_t szof) {
|
||||
// printf("calcMinCount sizeof = %d, min_count = %d, pot = %d\n", szof, elc, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
size_t _PIContainerConstantsBase::calcMaxCountForPoT(size_t szof) {
|
||||
return maxPoTAlloc / szof;
|
||||
}
|
||||
|
||||
|
||||
size_t _PIContainerConstantsBase::calcStepAfterPoT(size_t szof) {
|
||||
return calcMaxCountForPoT(szof);
|
||||
}
|
||||
|
||||
@@ -67,15 +67,28 @@ private:
|
||||
class PIP_EXPORT _PIContainerConstantsBase {
|
||||
public:
|
||||
static size_t calcMinCountPoT(size_t szof);
|
||||
static size_t calcMaxCountForPoT(size_t szof);
|
||||
static size_t calcStepAfterPoT(size_t szof);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class _PIContainerConstants {
|
||||
public:
|
||||
// minimum elements for container
|
||||
static size_t minCountPoT() {
|
||||
static const size_t ret = _PIContainerConstantsBase::calcMinCountPoT(sizeof(T));
|
||||
return ret;
|
||||
}
|
||||
// maximum elements for 2^n growth
|
||||
static size_t maxCountForPoT() {
|
||||
static const size_t ret = _PIContainerConstantsBase::calcMaxCountForPoT(sizeof(T));
|
||||
return ret;
|
||||
}
|
||||
// add elements after 2^n growth
|
||||
static size_t stepAfterPoT() {
|
||||
static const size_t ret = _PIContainerConstantsBase::calcStepAfterPoT(sizeof(T));
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user