14 #ifndef __UT_PageArrayImpl__
15 #define __UT_PageArrayImpl__
28 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
35 setCapacityIfNeeded(newsize);
41 IDX_T oldsize = pages->
size();
43 if (!PAGESHARDENED || TSIZE >= 0)
46 pages->
setSize(newsize, myImpl.getTupleSize());
48 if (newsize > oldsize)
51 pages->
fill(oldsize, newsize, initval);
52 else if (TSIZE == -1 && myImpl.getTupleSize() > 0)
53 pages->
fill(oldsize, newsize, initval, myImpl.getTupleSize());
58 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
67 setCapacityIfNeeded(newsize);
73 IDX_T oldsize = pages->
size();
79 if (newsize > oldsize)
80 pages->
fill(oldsize, newsize, initval);
84 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
90 setCapacityIfNeeded(newsize);
96 IDX_T oldsize = pages->
size();
100 if (!PAGESHARDENED || TSIZE >= 0)
103 pages->
setSize(newsize, myImpl.getTupleSize());
105 if (newsize > oldsize)
106 setConstant(oldsize, newsize, initval);
110 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
128 pages->
fill(start, end, v);
129 else if (TSIZE == -1 && myImpl.getTupleSize() > 0)
130 pages->
fill(start, end, v, myImpl.getTupleSize());
133 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
150 pages->
fill(start, end, v);
153 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
161 auto &hard = hardenTable();
167 if (SYSisSame<DATA_T,void>())
172 hard.template castType<int8>().setConstant(start, end, v);
return;
174 hard.template castType<uint8>().setConstant(start, end, v);
return;
176 hard.template castType<int16>().setConstant(start, end, v);
return;
178 hard.template castType<int32>().setConstant(start, end, v);
return;
180 hard.template castType<int64>().setConstant(start, end, v);
return;
182 hard.template castType<fpreal16>().setConstant(start, end, v);
return;
184 hard.template castType<fpreal32>().setConstant(start, end, v);
return;
186 hard.template castType<fpreal64>().setConstant(start, end, v);
return;
188 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
201 const exint tuplesize = getTupleSize();
228 for (
exint i = 0; i < tuplesize; ++i)
233 for (
exint i = 0; i < tuplesize; ++i)
236 pages->
fill(start, end, buf, tuplesize);
240 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
241 template<
typename SRC_T>
249 auto &hard = hardenTable();
255 if (SYSisSame<DATA_T,void>())
260 hard.template castType<int8>().setConstant(start, end, values);
return;
262 hard.template castType<uint8>().setConstant(start, end, values);
return;
264 hard.template castType<int16>().setConstant(start, end, values);
return;
266 hard.template castType<int32>().setConstant(start, end, values);
return;
268 hard.template castType<int64>().setConstant(start, end, values);
return;
270 hard.template castType<fpreal16>().setConstant(start, end, values);
return;
272 hard.template castType<fpreal32>().setConstant(start, end, values);
return;
274 hard.template castType<fpreal64>().setConstant(start, end, values);
return;
276 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
289 const exint tuplesize = getTupleSize();
293 if (SYSisSame<DATA_T,SRC_T>())
302 for (
exint i = 0; i < tuplesize; ++i)
303 buf[i] = UTconvertStorage<NotVoidType>(values[i]);
305 pages->
fill(start, end, buf, tuplesize);
309 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
321 PageTable *
const oldpages = myImpl.getPages();
324 exint tuplesize = getTupleSize();
325 if (tuplesize == 0 || !oldpages)
327 myImpl.setStorage(newstorage);
334 ThisType newarray(getTupleSize(), newstorage);
338 newarray.
moveRange(*
this,IDX_T(0),IDX_T(0),IDX_T(n));
344 castType<int8>().myImpl.getPages()->decRef(tuplesize);
break;
346 castType<uint8>().myImpl.getPages()->decRef(tuplesize);
break;
348 castType<int16>().myImpl.getPages()->decRef(tuplesize);
break;
350 castType<int32>().myImpl.getPages()->decRef(tuplesize);
break;
352 castType<int64>().myImpl.getPages()->decRef(tuplesize);
break;
354 castType<fpreal16>().myImpl.getPages()->decRef(tuplesize);
break;
356 castType<fpreal32>().myImpl.getPages()->decRef(tuplesize);
break;
358 castType<fpreal64>().myImpl.getPages()->decRef(tuplesize);
break;
361 myImpl.getPages()->decRef(tuplesize);
break;
365 PageTable *newpages = newarray.myImpl.getPages();
369 myImpl.setStorage(newstorage);
370 myImpl.getPages() = newpages;
373 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
377 exint oldtuplesize = getTupleSize();
379 UT_ASSERT_MSG_P((TSIZE == -1) || (newtuplesize == oldtuplesize),
"Can't change the tuple size of an array whose tuple size is fixed.");
382 if (newtuplesize == oldtuplesize || newtuplesize < 0)
385 PageTable *
const oldpages = myImpl.getPages();
390 myImpl.setTupleSize(newtuplesize);
397 ThisType newarray(newtuplesize, getStorage());
401 newarray.
moveRange(*
this,IDX_T(0),IDX_T(0),IDX_T(n));
404 switch (getStorage())
407 castType<int8>().myImpl.getPages()->decRef(oldtuplesize);
break;
409 castType<uint8>().myImpl.getPages()->decRef(oldtuplesize);
break;
411 castType<int16>().myImpl.getPages()->decRef(oldtuplesize);
break;
413 castType<int32>().myImpl.getPages()->decRef(oldtuplesize);
break;
415 castType<int64>().myImpl.getPages()->decRef(oldtuplesize);
break;
417 castType<fpreal16>().myImpl.getPages()->decRef(oldtuplesize);
break;
419 castType<fpreal32>().myImpl.getPages()->decRef(oldtuplesize);
break;
421 castType<fpreal64>().myImpl.getPages()->decRef(oldtuplesize);
break;
424 myImpl.getPages()->decRef(oldtuplesize);
break;
428 PageTable *newpages = newarray.myImpl.getPages();
432 myImpl.setTupleSize(newtuplesize);
433 myImpl.getPages() = newpages;
436 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
440 int64 mem = inclusive ?
sizeof(*this) : 0;
442 const PageTable *pages = myImpl.getPages();
467 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
477 const PageTable *pages = myImpl.getPages();
566 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
572 moveRange(*
this, srcstart, deststart, nelements);
578 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
579 template<
typename SRC_DATA_T,ex
int SRC_TSIZE,
bool SRC_TABLEHARDENED,
bool SRC_PAGESHARDENED>
583 IDX_T srcstart, IDX_T deststart, IDX_T nelements)
586 typedef typename SrcType::PageTable SrcPageTable;
587 typedef typename SrcType::PageTableEntry SrcPageTableEntry;
588 typedef typename SrcType::NotVoidType SrcNotVoidType;
591 UT_ASSERT_P(srcstart >= IDX_T(0) && deststart >= IDX_T(0));
598 auto &hard = hardenTable();
602 if (SYSisSame<DATA_T,void>())
608 hard.template castType<int8>().moveRange(src, srcstart, deststart, nelements);
return;
610 hard.template castType<uint8>().moveRange(src, srcstart, deststart, nelements);
return;
612 hard.template castType<int16>().moveRange(src, srcstart, deststart, nelements);
return;
614 hard.template castType<int32>().moveRange(src, srcstart, deststart, nelements);
return;
616 hard.template castType<int64>().moveRange(src, srcstart, deststart, nelements);
return;
618 hard.template castType<fpreal16>().moveRange(src, srcstart, deststart, nelements);
return;
620 hard.template castType<fpreal32>().moveRange(src, srcstart, deststart, nelements);
return;
622 hard.template castType<fpreal64>().moveRange(src, srcstart, deststart, nelements);
return;
624 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
632 if (SYSisSame<SRC_DATA_T,void>())
635 if ((
const void*)&src==(
void*)
this)
637 hard.moveRange(src.template castType<DATA_T>(), srcstart, deststart, nelements);
645 hard.moveRange(src.template castType<int8>(), srcstart, deststart, nelements);
return;
647 hard.moveRange(src.template castType<uint8>(), srcstart, deststart, nelements);
return;
649 hard.moveRange(src.template castType<int16>(), srcstart, deststart, nelements);
return;
651 hard.moveRange(src.template castType<int32>(), srcstart, deststart, nelements);
return;
653 hard.moveRange(src.template castType<int64>(), srcstart, deststart, nelements);
return;
655 hard.moveRange(src.template castType<fpreal16>(), srcstart, deststart, nelements);
return;
657 hard.moveRange(src.template castType<fpreal32>(), srcstart, deststart, nelements);
return;
659 hard.moveRange(src.template castType<fpreal64>(), srcstart, deststart, nelements);
return;
661 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
667 UT_ASSERT_P((!SYSisSame<DATA_T,void>()) && (!SYSisSame<SRC_DATA_T,void>()));
670 if (nelements <= IDX_T(0) || (SYSisSame<DATA_T,SRC_DATA_T>() && (
const void*)&src==(
void*)
this && srcstart == deststart))
680 const exint desttuplesize = getTupleSize();
683 if (srctuplesize == 0 || desttuplesize == 0)
686 const SrcPageTable *srcpagetable = src.myImpl.getPages();
687 PageTable *destpagetable = myImpl.getPages();
706 const SrcPageTableEntry *
const srcpage = srcpagetable->getPPage(srcpagenum);
710 bool issmalldestpage = destpagetable->
capacity() < IDX_T(thePageSize);
713 destpagecapacity = destpagetable->
capacity();
716 bool isfullpage = (nelements == IDX_T(thePageSize));
717 if (!isfullpage && destoff ==
UT_PageOff(0) && deststart+nelements ==
size())
721 bool issmallsrcpage = srcpagetable->capacity() < IDX_T(thePageSize);
722 bool samecapacity = (!issmalldestpage && !issmallsrcpage) ||
723 (issmalldestpage && issmallsrcpage && destpagetable->
capacity() == srcpagetable->capacity());
730 isfullpage = ((srcoff ==
UT_PageOff(0) && samecapacity) || srcpage->isConstant());
734 replacePage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, nelements, destpagecapacity);
740 copyPartialPage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, destoff, srcoff, nelements, destpagecapacity);
746 bool isoverlappingmovelater = (
747 SYSisSame<DATA_T,SRC_DATA_T>() &&
748 (
void*)
this == (
const void *)&src &&
749 (deststart > srcstart && deststart < srcstart+nelements)
752 if (srcoff == destoff)
767 const SrcPageTableEntry *psrcpagep = srcpagetable->getPPage(srcpagenum);
773 if (isoverlappingmovelater)
780 ntuplesfirstpage =
UT_PageOff(thePageSize)-destoff;
781 nelements -= IDX_T(
exint(ntuplesfirstpage));
790 const SrcPageTableEntry *psrcend = psrcpagep + nfullpages;
798 const SrcPageTableEntry *srcpage = psrcend;
805 bool isfullpage = deststart+nelements ==
size();
807 replacePage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, nleftover, thePageSize);
809 copyPartialPage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize,
UT_PageOff(0),
UT_PageOff(0), nleftover, thePageSize);
815 while (pdestpagep != pdestend)
819 const SrcPageTableEntry *srcpage = psrcend;
822 replacePage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, thePageSize, thePageSize);
832 const SrcPageTableEntry *srcpage = psrcpagep;
835 copyPartialPage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, destoff, srcoff, ntuplesfirstpage, thePageSize);
849 const SrcPageTableEntry *srcpage = psrcpagep;
853 copyPartialPage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, destoff, srcoff, ntuplesfirstpage, thePageSize);
855 nelements -= IDX_T(
exint(ntuplesfirstpage));
867 for (; pdestpagep != pdestend; ++psrcpagep, ++pdestpagep)
869 const SrcPageTableEntry *srcpage = psrcpagep;
872 replacePage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, thePageSize, thePageSize);
881 const SrcPageTableEntry *srcpage = psrcpagep;
888 bool isfullpage = deststart+nelements ==
size();
890 replacePage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize, nleftover, thePageSize);
892 copyPartialPage<SrcType>(destpage, srcpage, desttuplesize, srctuplesize,
UT_PageOff(0),
UT_PageOff(0), nleftover, thePageSize);
909 UT_PageOff spagestartind = pageOff(deststart-srcstart);
910 UT_PageOff dpagestartins = pageOff(srcstart-deststart);
922 const SrcPageTableEntry *psrcpagep = srcpagetable->getPPage(srcpagenum);
928 const SrcPageTableEntry *srcpage0 = psrcpagep;
930 const exint mintuplesize =
SYSmin(srctuplesize,desttuplesize);
941 bool issmalldestpage = destpagetable->
capacity() < IDX_T(thePageSize);
944 destpagecapacity = destpagetable->
capacity();
946 const SrcPageTableEntry *srcpage1 = psrcpagep + 1;
948 if (!PAGESHARDENED && srcpage0->isConstant() && srcpage1->isConstant())
950 const SrcNotVoidType *stuple0 = SrcType::getConstantPtr(srcpage0, 0, srctuplesize);
951 const SrcNotVoidType *stuple1 = SrcType::getConstantPtr(srcpage1, 0, srctuplesize);
952 if (SrcType::isEqualConst(stuple0, stuple1, srctuplesize))
955 if (destpage->
isConstant() && isEqualConst(getConstantPtr(destpage, 0, desttuplesize), stuple0, mintuplesize))
960 bool isfullpage = (nelements == IDX_T(thePageSize)) || (destoff ==
UT_PageOff(0) && deststart+nelements ==
size());
963 makeConstantFrom<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize);
970 hardenConstantPage(destpage, destpagecapacity, desttuplesize);
971 else if (!PAGESHARDENED && destpage->
isShared())
972 hardenSharedPage(destpage, destpagecapacity, desttuplesize);
975 if (isoverlappingmovelater)
977 copyPartialPage<SrcType>(destpage, srcpage1, desttuplesize, srctuplesize, destoff+n0,
UT_PageOff(0), nelements-n0, destpagecapacity);
978 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize, destoff, srcoff, n0, destpagecapacity);
982 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize, destoff, srcoff, n0, destpagecapacity);
983 copyPartialPage<SrcType>(destpage, srcpage1, desttuplesize, srctuplesize, destoff+n0,
UT_PageOff(0), nelements-n0, destpagecapacity);
991 if (isoverlappingmovelater)
994 UT_ASSERT_MSG(0,
"Implement this!!! It should be like the code below, only copying chunks in reverse order.");
1004 if (destoff < spagestartind)
1013 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize, destoff, srcoff, n0,
UT_PageOff(thePageSize));
1018 srcpage0 = psrcpagep;
1019 nelements -= IDX_T(
exint(n0));
1028 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize, destoff, srcoff, n0,
UT_PageOff(thePageSize));
1030 nelements -= IDX_T(
exint(n0));
1034 for (; nelements >= IDX_T(thePageSize); nelements -= IDX_T(thePageSize), ++pdestpagep, ++psrcpagep, (srcpage0 = psrcpagep))
1044 const SrcPageTableEntry *srcpage1 = psrcpagep + 1;
1046 if (!PAGESHARDENED && srcpage0->isConstant() && srcpage1->isConstant())
1048 const SrcNotVoidType *stuple0 = SrcType::getConstantPtr(srcpage0, 0, srctuplesize);
1049 const SrcNotVoidType *stuple1 = SrcType::getConstantPtr(srcpage1, 0, srctuplesize);
1050 if (SrcType::isEqualConst(stuple0, stuple1, srctuplesize))
1053 if (destpage->
isConstant() && isEqualConst(getConstantPtr(destpage, 0, desttuplesize), stuple0, mintuplesize))
1058 makeConstantFrom<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize);
1063 if (!PAGESHARDENED && destpage->
isConstant())
1064 hardenConstantPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1065 else if (!PAGESHARDENED && destpage->
isShared())
1066 hardenSharedPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1068 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize,
UT_PageOff(0), dpagestartins, spagestartind,
UT_PageOff(thePageSize));
1069 copyPartialPage<SrcType>(destpage, srcpage1, desttuplesize, srctuplesize, spagestartind,
UT_PageOff(0), dpagestartins,
UT_PageOff(thePageSize));
1073 if (nelements > IDX_T(0))
1077 const bool isfullmaybeconstpage = !PAGESHARDENED && (deststart+nelements ==
size());
1079 if (nelements > IDX_T(
exint(spagestartind)))
1087 const SrcPageTableEntry *srcpage1 = psrcpagep + 1;
1089 if (isfullmaybeconstpage && srcpage0->isConstant() && srcpage1->isConstant())
1091 const SrcNotVoidType *stuple0 = SrcType::getConstantPtr(srcpage0, 0, srctuplesize);
1092 const SrcNotVoidType *stuple1 = SrcType::getConstantPtr(srcpage1, 0, srctuplesize);
1093 if (SrcType::isEqualConst(stuple0, stuple1, srctuplesize))
1096 if (destpage->
isConstant() && isEqualConst(getConstantPtr(destpage, 0, desttuplesize), stuple0, mintuplesize))
1101 makeConstantFrom<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize);
1106 if (!PAGESHARDENED && destpage->
isConstant())
1107 hardenConstantPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1108 else if (!PAGESHARDENED && destpage->
isShared())
1109 hardenSharedPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1111 copyPartialPage<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize,
UT_PageOff(0), dpagestartins, spagestartind,
UT_PageOff(thePageSize));
1112 copyPartialPage<SrcType>(destpage, srcpage1, desttuplesize, srctuplesize, spagestartind,
UT_PageOff(0),
UT_PageOff(
exint(nelements))-spagestartind,
UT_PageOff(thePageSize));
1122 if (isfullmaybeconstpage && srcpage0->isConstant())
1124 const SrcNotVoidType *stuple0 = SrcType::getConstantPtr(srcpage0, 0, srctuplesize);
1126 if (destpage->
isConstant() && isEqualConst(getConstantPtr(destpage, 0, desttuplesize), stuple0, mintuplesize))
1131 makeConstantFrom<SrcType>(destpage, srcpage0, desttuplesize, srctuplesize);
1135 if (!PAGESHARDENED && destpage->
isConstant())
1136 hardenConstantPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1137 else if (!PAGESHARDENED && destpage->
isShared())
1138 hardenSharedPage(destpage,
UT_PageOff(thePageSize), desttuplesize);
1146 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1151 UT_ASSERT_P(astart >= IDX_T(0) && bstart >= IDX_T(0));
1153 UT_ASSERT_MSG_P(astart >= bstart+nelements || bstart >= astart+nelements,
"Ranges can't overlap when swapping!");
1154 if (nelements <= IDX_T(0))
1156 auto &hard = hardenTable();
1157 if (!SYSisSame<DATA_T,void>())
1160 exint tuplesize = getTupleSize();
1161 for (IDX_T i(0); i < nelements; ++i)
1163 for (
exint component = 0; component < tuplesize; ++component)
1165 UTswap(hard(astart+i, component), hard(bstart+i, component));
1176 hard.template castType<int8>().swapRange(astart, bstart, nelements);
return;
1178 hard.template castType<uint8>().swapRange(astart, bstart, nelements);
return;
1180 hard.template castType<int16>().swapRange(astart, bstart, nelements);
return;
1182 hard.template castType<int32>().swapRange(astart, bstart, nelements);
return;
1184 hard.template castType<int64>().swapRange(astart, bstart, nelements);
return;
1186 hard.template castType<fpreal16>().swapRange(astart, bstart, nelements);
return;
1188 hard.template castType<fpreal32>().swapRange(astart, bstart, nelements);
return;
1190 hard.template castType<fpreal64>().swapRange(astart, bstart, nelements);
return;
1192 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
1197 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1198 template<
typename SrcType>
1204 typedef typename SrcType::NotVoidType SrcNotVoidType;
1210 UT_ASSERT_P((SYSisSame<IndexType, typename SrcType::IndexType>()));
1211 UT_ASSERT_P(desttuplesize > 0 && srctuplesize > 0);
1212 UT_ASSERT_P((TSIZE == -1 || TSIZE == desttuplesize) && (SRC_TSIZE == -1 || SRC_TSIZE == srctuplesize));
1215 if (src->isConstant())
1217 if (!PAGESHARDENED && (dest->
isConstant() || desttuplesize <= srctuplesize))
1218 makeConstantFrom<SrcType>(dest,
src, desttuplesize, srctuplesize);
1226 UT_ASSERT_P(PAGESHARDENED || (!dest->isConstant() && desttuplesize > srctuplesize));
1228 if (!PAGESHARDENED && dest->isShared())
1229 hardenSharedPage(dest, destpagecapacity, desttuplesize);
1234 NotVoidType *destpageend = destpagedata + (desttuplesize*destpagesize);
1236 const SrcNotVoidType *stuple = SrcType::getConstantPtr(src, 0, srctuplesize);
1238 const exint mintuplesize =
SYSmin(srctuplesize,desttuplesize);
1239 const exint desttupleextra = desttuplesize-mintuplesize;
1241 fillNonConstWithConst(destpagedata, destpageend, stuple, mintuplesize, desttupleextra);
1244 else if (!PAGESHARDENED && SYSisSame<DATA_T,SRC_DATA_T>() && desttuplesize == srctuplesize)
1255 if (dest->
isRefd(bytesize))
1268 hardenConstantPage(dest, destpagecapacity, desttuplesize);
1269 else if (!PAGESHARDENED && dest->
isShared())
1270 hardenSharedPage(dest, destpagecapacity, desttuplesize);
1274 const SrcNotVoidType *srcpagedata = src->getFirstPtr();
1276 copyNonConst(destpagedata, srcpagedata, desttuplesize, srctuplesize, destpagesize);
1280 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1281 template<
typename SrcType>
1288 typedef typename SrcType::NotVoidType SrcNotVoidType;
1294 UT_ASSERT_P((SYSisSame<IndexType, typename SrcType::IndexType>()));
1295 UT_ASSERT_P(desttuplesize > 0 && srctuplesize > 0);
1296 UT_ASSERT_P((TSIZE == -1 || TSIZE == desttuplesize) && (SRC_TSIZE == -1 || SRC_TSIZE == srctuplesize));
1303 if (src->isConstant())
1305 const SrcNotVoidType *stuple = SrcType::getConstantPtr(src, 0, srctuplesize);
1307 const exint mintuplesize =
SYSmin(srctuplesize,desttuplesize);
1312 const NotVoidType *tuple = getConstantPtr(dest, 0, desttuplesize);
1315 if (isEqualConst(tuple, stuple, mintuplesize))
1318 hardenConstantPage(dest, destpagecapacity, desttuplesize);
1321 if (!PAGESHARDENED && dest->
isShared())
1322 hardenSharedPage(dest, destpagecapacity, desttuplesize);
1326 NotVoidType *destpageend = destpagedata + (desttuplesize*ntuples);
1328 const exint desttupleextra = desttuplesize-mintuplesize;
1330 fillNonConstWithConst(destpagedata, destpageend, stuple, mintuplesize, desttupleextra);
1336 hardenConstantPage(dest, destpagecapacity, desttuplesize);
1337 else if (!PAGESHARDENED && dest->
isShared())
1338 hardenSharedPage(dest, destpagecapacity, desttuplesize);
1352 if (srcoff == destoff)
1356 destpagedata += desttuplesize*destoff;
1357 NotVoidType *destend = destpagedata + desttuplesize*ntuples;
1359 const SrcNotVoidType *srcpagedata = src->getFirstPtr();
1360 srcpagedata += srctuplesize*srcoff;
1363 if (destoff < srcoff)
1367 *destpagedata = *srcpagedata;
1370 }
while (destpagedata != destend);
1375 const SrcNotVoidType *srcend = srcpagedata + srctuplesize*ntuples;
1381 }
while (destpagedata != destend);
1388 destpagedata += desttuplesize*destoff;
1390 const SrcNotVoidType *srcpagedata = src->getFirstPtr();
1391 srcpagedata += srctuplesize*srcoff;
1393 copyNonConst(destpagedata, srcpagedata, desttuplesize, srctuplesize,
UT_PageOff(ntuples));
1397 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1398 template<
typename SrcType>
1405 typedef typename SrcType::PageTableEntry SrcPageTableEntry;
1406 typedef typename SrcType::NotVoidType SrcNotVoidType;
1408 const exint SRC_TSIZE = SrcType::theTupleSize;
1415 UT_ASSERT_P((SYSisSame<IndexType, typename SrcType::IndexType>()));
1416 UT_ASSERT_P(desttuplesize > 0 && srctuplesize > 0);
1417 UT_ASSERT_P((TSIZE == -1 || TSIZE == desttuplesize) && (SRC_TSIZE == -1 || SRC_TSIZE == srctuplesize));
1418 UT_ASSERT_MSG_P(desttuplesize <= srctuplesize || dest->isConstant(),
"The higher component values may not have been constant!");
1432 const bool issrczero = src->isConstantAndZeroSafe();
1441 if (((TSIZE == SRC_TSIZE && TSIZE != -1) || (desttuplesize == srctuplesize)) && SYSisSame<DATA_T,SRC_DATA_T>())
1449 const bool typefitsinline = PageTableEntry::typeFitsInline(desttuplesize);
1469 const SrcNotVoidType *
const srctuple = SrcType::getConstantPtr(src, 0, srctuplesize);
1471 const exint mintuplesize =
SYSmin(desttuplesize, srctuplesize);
1474 if (PageTableEntry::typeFitsInline(desttuplesize))
1494 memset(tuple, 0, mintuplesize*
sizeof(
NotVoidType));
1498 for (
exint i = 0; i < mintuplesize; ++i)
1499 tuple[i] = UTconvertStorage<NotVoidType>(srctuple[i]);
1515 if (desttuplesize <= srctuplesize && issrczero)
1524 if (desttuplesize > srctuplesize && issrczero)
1526 equal =
isZero(tuple, mintuplesize);
1530 for (
exint i = 0; i < mintuplesize; ++i)
1532 if (tuple[i] != UTconvertStorage<NotVoidType>(srctuple[i]))
1548 if (desttuplesize > srctuplesize)
1559 memset(newtuple, 0, srctuplesize*
sizeof(
NotVoidType));
1563 for (
exint i = 0; i < srctuplesize; ++i)
1564 newtuple[i] = UTconvertStorage<NotVoidType>(srctuple[i]);
1567 for (
exint i = srctuplesize; i < desttuplesize; ++i)
1568 newtuple[i] = tuple[i];
1584 memset(tuple, 0, mintuplesize*
sizeof(
NotVoidType));
1588 for (
exint i = 0; i < mintuplesize; ++i)
1589 tuple[i] = UTconvertStorage<NotVoidType>(srctuple[i]);
1596 if (desttuplesize <= srctuplesize && issrczero)
1607 memset(tuple, 0, desttuplesize*
sizeof(
NotVoidType));
1611 for (
exint i = 0; i < mintuplesize; ++i)
1612 tuple[i] = UTconvertStorage<NotVoidType>(srctuple[i]);
1614 if (desttuplesize > srctuplesize)
1617 memset(tuple+srctuplesize, 0, (desttuplesize-srctuplesize)*
sizeof(
NotVoidType));
1623 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1624 template<
typename SrcNotVo
idType>
1629 const SrcNotVoidType *__restrict stuple,
1631 exint desttupleextra)
1638 if (!SYSisSame<NotVoidType,SrcNotVoidType>())
1642 for (
exint i = 0; i < mintuplesize; ++i, ++destpagedata)
1643 *destpagedata = UTconvertStorage<NotVoidType>(stuple[i]);
1644 destpagedata += desttupleextra;
1645 }
while(destpagedata < destpageend);
1651 for (
exint i = 0; i < mintuplesize; ++i, ++destpagedata)
1652 *destpagedata = stuple[i];
1653 destpagedata += desttupleextra;
1654 }
while(destpagedata < destpageend);
1659 if (!SYSisSame<NotVoidType,SrcNotVoidType>())
1663 for (
exint i = 0; i < mintuplesize; ++i, ++destpagedata)
1665 destpagedata += desttupleextra;
1666 }
while(destpagedata < destpageend);
1672 if (SYSisPOD<NotVoidType>())
1674 for (
exint i = 0; i < mintuplesize; ++i, ++destpagedata)
1680 for (
exint i = 0; i < mintuplesize; ++i, ++destpagedata)
1683 destpagedata += desttupleextra;
1684 }
while(destpagedata < destpageend);
1689 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1690 template<
typename SrcNotVo
idType>
1694 const SrcNotVoidType *__restrict srcpagedata,
1695 const exint desttuplesize,
1696 const exint srctuplesize,
1701 NotVoidType *destpageend = destpagedata + ntuples*desttuplesize;
1703 if (desttuplesize == srctuplesize)
1706 if (SYSisSame<NotVoidType,SrcNotVoidType>())
1710 *destpagedata = *srcpagedata;
1713 }
while(destpagedata < destpageend);
1719 *destpagedata = UTconvertStorage<NotVoidType>(*srcpagedata);
1722 }
while(destpagedata < destpageend);
1727 const exint mintuplesize =
SYSmin(desttuplesize, srctuplesize);
1728 const exint srctupleextra = srctuplesize - mintuplesize;
1729 const exint desttupleextra = desttuplesize - mintuplesize;
1732 if (SYSisSame<NotVoidType,SrcNotVoidType>())
1736 for (
exint i = 0; i < mintuplesize; ++i, ++srcpagedata, ++destpagedata)
1737 *destpagedata = *srcpagedata;
1738 destpagedata += desttupleextra;
1739 srcpagedata += srctupleextra;
1740 }
while(destpagedata < destpageend);
1746 for (
exint i = 0; i < mintuplesize; ++i, ++srcpagedata, ++destpagedata)
1747 *destpagedata = UTconvertStorage<NotVoidType>(*srcpagedata);
1748 destpagedata += desttupleextra;
1749 srcpagedata += srctupleextra;
1750 }
while(destpagedata < destpageend);
1755 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1756 template<
typename SrcNotVo
idType>
1764 if ((
const void*)stuple == (
void*)tuple)
1767 if (!stuple || !tuple)
1773 if (!SYSisSame<NotVoidType,SrcNotVoidType>())
1778 isequal = (tuple[0] == UTconvertStorage<NotVoidType>(stuple[0]));
1779 for (
exint i = 1; i < mintuplesize; ++i)
1780 isequal &= (tuple[i] == UTconvertStorage<NotVoidType>(stuple[i]));
1786 isequal = (tuple[0] == stuple[0]);
1787 for (
exint i = 1; i < mintuplesize; ++i)
1788 isequal &= (tuple[i] == stuple[i]);
1794 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1823 PageTableEntry *page =
getPPage(startpage);
1827 if (page->isConstant())
1834 for (
exint i = 0; i < TSIZE; ++i)
1835 equal &= (tuple[i] == val);
1844 else if (page->isShared())
1852 NotVoidType *end = data + TSIZE*((endpage != startpage) ? pagecapacity : endoff);
1853 data += TSIZE*startoff;
1857 if (endpage == startpage)
1864 for (; startpage < endpage; ++startpage)
1866 PageTableEntry *page =
getPPage(startpage);
1883 PageTableEntry *page =
getPPage(startpage);
1885 if (!PAGESHARDENED && startpage >=
numPages(mySize)-1 && endoff >=
pageOff(mySize-1)+1)
1893 if (page->isConstant())
1900 for (
exint i = 0; i < TSIZE; ++i)
1901 equal &= (tuple[i] == val);
1910 else if (page->isShared())
1925 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
1935 UT_ASSERT_MSG_P(myRefCount.relaxedLoad() == 1,
"The table must already be hardened before we modify it!");
1943 this)->fill(start, end, val);
1945 else if (tuplesize == 2)
1948 this)->fill(start, end, val);
1950 else if (tuplesize == 3)
1953 this)->fill(start, end, val);
1958 this)->fill(start, end, val);
1981 PageTableEntry *page = getPPage(startpage);
1985 if (page->isConstant())
1992 for (
exint i = 0; i < tuplesize; ++i)
1993 equal &= (tuple[i] == val);
2002 else if (page->isShared())
2010 NotVoidType *end = data + tuplesize*((endpage != startpage) ? pagecapacity : endoff);
2011 data += tuplesize*startoff;
2015 if (endpage == startpage)
2021 for (; startpage < endpage; ++startpage)
2023 PageTableEntry *page = getPPage(startpage);
2039 PageTableEntry *page = getPPage(startpage);
2041 if (!PAGESHARDENED && startpage >=
numPages(mySize)-1 && endoff >=
pageOff(mySize-1)+1)
2049 if (page->isConstant())
2056 for (
exint i = 0; i < tuplesize; ++i)
2057 equal &= (tuple[i] == val);
2066 else if (page->isShared())
2081 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
2091 UT_ASSERT_MSG_P(myRefCount.relaxedLoad() == 1,
"The table must already be hardened before we modify it!");
2105 PageTableEntry *page = getPPage(startpage);
2109 if (page->isConstant())
2116 for (
exint i = 0; i < tuplesize; ++i)
2117 equal &= (tuple[i] == values[i]);
2121 for (
exint i = 0; i < tuplesize; ++i)
2127 else if (page->isShared())
2135 NotVoidType *end = data + tuplesize*((endpage != startpage) ? pagecapacity : endoff);
2136 data += tuplesize*startoff;
2139 for (
exint i = 0; i < tuplesize; ++i, ++
data)
2143 if (endpage == startpage)
2149 for (; startpage < endpage; ++startpage)
2151 PageTableEntry *page = getPPage(startpage);
2161 for (
exint i = 0; i < tuplesize; ++i, ++
data)
2170 PageTableEntry *page = getPPage(startpage);
2172 if (!PAGESHARDENED && startpage >=
numPages(mySize)-1 && endoff >=
pageOff(mySize-1)+1)
2180 if (page->isConstant())
2187 for (
exint i = 0; i < tuplesize; ++i)
2188 equal &= (tuple[i] == values[i]);
2192 for (
exint i = 0; i < tuplesize; ++i)
2198 else if (page->isShared())
2209 for (
exint i = 0; i < tuplesize; ++i, ++
data)
2216 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
2225 UT_ASSERT_MSG_P(myRefCount.relaxedLoad() == 1,
"The table must already be hardened before we modify it!");
2239 PageTableEntry *page = getPPage(startpage);
2243 if (page->isConstant())
2247 equal = tuple ? (*tuple ==
val) :
isZero(val);
2251 else if (page->isShared())
2264 if (endpage == startpage)
2271 for (; startpage < endpage; ++startpage)
2273 PageTableEntry *page = getPPage(startpage);
2289 PageTableEntry *page = getPPage(startpage);
2291 if (!PAGESHARDENED && startpage >=
numPages(mySize)-1 && endoff >=
pageOff(mySize-1)+1)
2299 if (page->isConstant())
2303 equal = tuple ? (*tuple ==
val) :
isZero(val);
2307 else if (page->isShared())
2322 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
2323 template<
typename DEST_DATA_T,ex
int DEST_TSIZE>
2329 if (SYSisSame<DATA_T,void>())
2336 castType<DEST_DATA_T>().
getVectorRange(srcstart, nelements, dest);
2343 castType<int8>().
getVectorRange(srcstart, nelements, dest);
return;
2345 castType<uint8>().
getVectorRange(srcstart, nelements, dest);
return;
2347 castType<int16>().
getVectorRange(srcstart, nelements, dest);
return;
2349 castType<int32>().
getVectorRange(srcstart, nelements, dest);
return;
2351 castType<int64>().
getVectorRange(srcstart, nelements, dest);
return;
2353 castType<fpreal16>().
getVectorRange(srcstart, nelements, dest);
return;
2355 castType<fpreal32>().
getVectorRange(srcstart, nelements, dest);
return;
2357 castType<fpreal64>().
getVectorRange(srcstart, nelements, dest);
return;
2359 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
2369 if (TSIZE == -1 && myImpl.getTupleSize() == DEST_TSIZE)
2371 castTupleSize<DEST_TSIZE>().
getVectorRange(srcstart, nelements, dest);
2378 for (IDX_T srcend(srcstart+nelements); srcstart < srcend; ++srcstart, ++vdest)
2379 *vdest = getVector<DEST_DATA_T,DEST_TSIZE>(srcstart);
2382 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
2383 template<
typename SRC_DATA_T,ex
int SRC_TSIZE>
2387 if (nelements <= IDX_T(0))
2392 UT_ASSERT_MSG_P((!SYSisSame<SRC_DATA_T,void>()),
"Source type must be known.");
2396 if (SYSisSame<DATA_T,void>())
2403 hard.template castType<SRC_DATA_T>().
setVectorRange(deststart, nelements, src);
2410 hard.template castType<int8>().
setVectorRange(deststart, nelements, src);
return;
2412 hard.template castType<uint8>().
setVectorRange(deststart, nelements, src);
return;
2414 hard.template castType<int16>().
setVectorRange(deststart, nelements, src);
return;
2416 hard.template castType<int32>().
setVectorRange(deststart, nelements, src);
return;
2418 hard.template castType<int64>().
setVectorRange(deststart, nelements, src);
return;
2420 hard.template castType<fpreal16>().
setVectorRange(deststart, nelements, src);
return;
2422 hard.template castType<fpreal32>().
setVectorRange(deststart, nelements, src);
return;
2424 hard.template castType<fpreal64>().
setVectorRange(deststart, nelements, src);
return;
2426 UT_ASSERT_MSG(0,
"Can't have a UT_PageArray with DATA_T void and invalid storage!");
2436 if (TSIZE == -1 && myImpl.getTupleSize() == SRC_TSIZE)
2438 hard.template castTupleSize<SRC_TSIZE>().
setVectorRange(deststart, nelements, src);
2443 for (IDX_T destend(deststart+nelements); deststart < destend; ++deststart, ++
src)
2447 template<
typename DATA_T,ex
int TSIZE,
bool TABLEHARDENED,
bool PAGESHARDENED,ex
int THEPAGEBITS,
typename IDX_T>
2456 if (SYSisSame<DATA_T,void>())
2468 UT_ASSERT_MSG(0,
"Only 16-bit, 32-bit, and 64-bit floats should be considered float types!");
2481 const PageTable *pages = myImpl.getPages();
2497 for (; pagenum <= endpagenum; ++pagenum)
2506 for (
exint i = 0; i < tuplesize; ++i)
2515 const NotVoidType *end = data + ((pagenum == endpagenum) ? endpageoff : thePageSize*tuplesize);
static void copyNonConst(NotVoidType *destpagedata, const SrcNotVoidType *srcpagedata, exint desttuplesize, exint srctuplesize, UT_PageOff ntuples)
GLenum GLuint GLenum GLsizei const GLchar * buf
static SYS_FORCE_INLINE const NotVoidType * getConstantPtr(const PageTableEntry *page, exint component=0, exint tuplesize=TSIZE)
SYS_FORCE_INLINE void setSize(IDX_T newsize)
SYS_FORCE_INLINE void * getFirstPtrVoid()
Returns the data pointer, if not a constant page.
NotVoid< DATA_T >::type NotVoidType
void setTupleSize(exint newtuplesize, const UT_Defaults &v)
getFileOption("OpenEXR:storage") storage
int64 getI(exint i=0) const
SYS_FORCE_INLINE IDX_T size() const
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
SYS_FORCE_INLINE bool isShared() const
void countMemory(UT_MemoryCounter &counter, bool inclusive) const
constexpr bool SYSisNan(const F f)
SYS_FORCE_INLINE PageTableEntry * getFirstPage()
void setConstant(IDX_T start, IDX_T end, NotVoidType v)
SYS_FORCE_INLINE const PageTableEntry * getPPage(UT_PageNum i) const
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
SYS_FORCE_INLINE exint getTupleSize() const
virtual bool countShared(size_t size, exint refcount, const void *p)
#define UT_ASSERT_MSG_P(ZZ,...)
#define UT_MEMORY_DEBUG_LOG_SHARED(m, s, p, r)
SYS_FORCE_INLINE constexpr bool UTisFloatStorage(UT_Storage storage)
Returns true iff the given storage type represents a floating-point number.
SYS_FORCE_INLINE IDX_T size() const
NOTE: This is the size of the full array, not the number of pages.
#define UT_IF_ASSERT_P(ZZ)
SYS_FORCE_INLINE UT_Storage getStorage() const
SYS_FORCE_INLINE exint getRefCount() const
bool hasNanInRange(IDX_T start, IDX_T end) const
void setVectorRange(IDX_T deststart, IDX_T nelements, const UT_FixedVector< SRC_DATA_T, SRC_TSIZE > *src)
SYS_FORCE_INLINE bool isShared() const
void fill(IDX_T start, IDX_T end, const NotVoidType &val)
static bool isEqualConst(const NotVoidType *tuple, const SrcNotVoidType *stuple, exint mintuplesize)
SYS_FORCE_INLINE void setConstantBit()
#define UT_ASSERT_MSG(ZZ,...)
SYS_FORCE_INLINE exint getRefCount() const
SYS_FORCE_INLINE bool isConstantZero() const
This is only valid to call if the type doesn't fit inline.
static SYS_FORCE_INLINE UT_PageOff pageOff(IDX_T i)
static SYS_FORCE_INLINE UT_PageNum numPages(IDX_T nelements)
SYS_FORCE_INLINE bool isRefd(exint tuplebytes) const
SYS_FORCE_INLINE IDX_T capacity() const
NOTE: This is the capacity of the full array, not the capacity of pages.
static SYS_FORCE_INLINE bool isZero(const T &val)
SYS_FORCE_INLINE IDX_T capacity() const
bool mustCountUnshared() const
#define UT_MEMORY_DEBUG_LOG(m, s)
SYS_FORCE_INLINE NotVoidType * getInlinePtr(exint tuplesize)
Returns the data pointer, if an inline constant page.
void setCapacity(IDX_T newcapacity)
SYS_FORCE_INLINE void * getMaskedPtrVoid()
static void copyPartialPage(PageTableEntry *dest, const typename SrcType::PageTableEntry *src, exint desttuplesize, exint srctuplesize, UT_PageOff destoff, UT_PageOff srcoff, UT_PageOff ntuples, UT_PageOff destpagecapacity)
SYS_FORCE_INLINE bool isConstantAndZeroSafe() const
SYS_FORCE_INLINE void incRef()
static void makeConstantFrom(PageTableEntry *dest, const typename SrcType::PageTableEntry *src, exint desttuplesize, exint srctuplesize)
SYS_FORCE_INLINE T relaxedLoad() const
void moveRange(IDX_T srcstart, IDX_T deststart, IDX_T nelements)
void countUnshared(size_t size)
SYS_FORCE_INLINE int64 getMemoryUsage(exint tuplebytes) const
SYS_AtomicInt< int32 > SYS_AtomicCounter
void setSize(IDX_T newsize)
fpreal64 getF(exint i=0) const
GLenum GLsizei GLsizei GLint * values
void swapRange(IDX_T astart, IDX_T bstart, IDX_T nelements)
SYS_FORCE_INLINE void * getFirstPtrVoidUnsafe()
void setStorage(const UT_Storage newstorage)
static void fillNonConstWithConst(NotVoidType *destpagedata, NotVoidType *destpageend, const SrcNotVoidType *stuple, exint mintuplesize, exint desttupleextra)
SYS_FORCE_INLINE NotVoidType * getMaskedPtr()
SYS_FORCE_INLINE bool isConstant() const
This is always valid to call.
static void hardenSharedPage(PageTableEntry *page, UT_PageOff pagecapacity, exint tuplesize=TSIZE)
bool mustCountShared() const
static SYS_FORCE_INLINE void makeConstant(PageTableEntry *page, const UT_FixedVector< NotVoidType, theSafeTupleSize > &val)
SYS_FORCE_INLINE UT_PageArray< DATA_T, TSIZE, true, PAGESHARDENED, THEPAGEBITS, IDX_T > & hardenTable()
static const exint thePageSize
SYS_FORCE_INLINE void alloc(UT_PageOff nelements, exint tuplesize=TSIZE)
static void hardenConstantPage(PageTableEntry *page, UT_PageOff pagecapacity, exint tuplesize=TSIZE)
int64 getMemoryUsage(bool inclusive) const
static SYS_FORCE_INLINE UT_PageNum pageNum(IDX_T i)
SYS_FORCE_INLINE void setVector(IDX_T i, const TS &as)
void getVectorRange(IDX_T srcstart, IDX_T nelements, UT_FixedVector< DEST_DATA_T, DEST_TSIZE > *dest) const
SYS_FORCE_INLINE constexpr bool UTisIntStorage(UT_Storage storage)
Returns true iff the given storage type represents an integer.
SYS_FORCE_INLINE constexpr int UTstorageSize(UT_Storage storage)
Returns the number of bytes in the given storage type.
SYS_FORCE_INLINE void initZero()
SYS_FORCE_INLINE exint getTupleSize() const
SYS_FORCE_INLINE NotVoidType * getFirstPtr()
Returns the data pointer, if not a constant page.
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
SYS_FORCE_INLINE void decRef()
static void replacePage(PageTableEntry *dest, const typename SrcType::PageTableEntry *src, exint desttuplesize, exint srctuplesize, UT_PageOff destpagesize, UT_PageOff destpagecapacity)