mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Remove capacity safeties.
This commit is contained in:
parent
5306034893
commit
a5f5dcc00f
@ -37,16 +37,7 @@ template <typename T> class SPSCQueue {
|
||||
public:
|
||||
explicit SPSCQueue(const size_t capacity)
|
||||
: capacity_(capacity) {
|
||||
// The queue needs at least one element
|
||||
if (capacity_ < 1) {
|
||||
capacity_ = 1;
|
||||
}
|
||||
capacity_++; // Needs one slack element
|
||||
// Prevent overflowing size_t
|
||||
if (capacity_ > SIZE_MAX - 2 * kPadding) {
|
||||
capacity_ = SIZE_MAX - 2 * kPadding;
|
||||
}
|
||||
|
||||
slots_ = (T*)tracy_malloc(sizeof(T) * (capacity_ + 2 * kPadding));
|
||||
|
||||
static_assert(alignof(SPSCQueue<T>) == kCacheLineSize, "");
|
||||
|
Loading…
Reference in New Issue
Block a user