15 #include "../core/alloc_func.hpp"
71 static const size_t header_size =
sizeof(
BlobHeader);
119 if (min_alloc < (1 << 9)) {
120 if (min_alloc < (1 << 5))
return (1 << 5);
121 return (min_alloc < (1 << 7)) ? (1 << 7) : (1 << 9);
123 if (min_alloc < (1 << 15)) {
124 if (min_alloc < (1 << 11))
return (1 << 11);
125 return (min_alloc < (1 << 13)) ? (1 << 13) : (1 << 15);
127 if (min_alloc < (1 << 20)) {
128 if (min_alloc < (1 << 17))
return (1 << 17);
129 return (min_alloc < (1 << 19)) ? (1 << 19) : (1 << 20);
131 min_alloc = (min_alloc | ((1 << 20) - 1)) + 1;
226 memcpy(
Append(num_bytes), p, num_bytes);
244 size_t new_size =
Length() + num_bytes;
255 byte *pNewData =
Prepare(num_bytes);
266 assert(new_size < SIZE_MAX - header_size -
tail_reserve);
275 if (tmp->
items != 0) {
307 template <
typename T>
313 static const size_t type_size =
sizeof(T);
320 assert(src.header != NULL);
331 assert(header == NULL);
354 assert(index <
Size());
373 return (
Data() + index);
377 inline const T *
Data(
size_t index)
const
380 return (
Data() + index);
416 inline OnTransfer Transfer()
418 return OnTransfer(*
this);