+
+ return ptr + oldcount;
+ }
+
+ // align must be power-of-two
+ void align_to(size_t align, size_t max = ULONG_MAX)
+ {
+ size_t newcount = (count + align - 1) & ~(align - 1);
+
+ if (newcount < count)
+ throw ArrayException();
+
+ if (newcount > max)
+ throw ArrayException();
+
+ if (newcount > bufsize)
+ grow(ll_get_order_round_up(newcount));
+ }
+
+ // Caller must sync against all writers.
+ void append(T *newptr, size_t len, size_t max = ULONG_MAX)
+ {
+ memcpy(ptr + grow_by(len, max), newptr, len * sizeof(T));