Skip to content

Commit

Permalink
Nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
dzhdanNV committed Dec 17, 2024
1 parent 9233389 commit 8463059
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/Shared/StdAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ class Scratch {
Scratch(const AllocationCallbacks& allocator, T* mem, size_t num)
: m_Allocator(allocator)
, m_Mem(mem)
, m_Num(num)
{
, m_Num(num) {
m_IsHeap = (num * sizeof(T) + alignof(T)) > MAX_STACK_ALLOC_SIZE;
}

Expand All @@ -187,7 +186,7 @@ class Scratch {
return m_Mem;
}

inline T& operator [] (size_t i) const {
inline T& operator[](size_t i) const {
assert(i < m_Num);
return m_Mem[i];
}
Expand All @@ -200,8 +199,8 @@ class Scratch {
};

#define AllocateScratch(device, T, elementNum) \
{ (device).GetStdAllocator().GetInterface(), \
{(device).GetStdAllocator().GetInterface(), \
((elementNum) * sizeof(T) + alignof(T)) > MAX_STACK_ALLOC_SIZE \
? (T*)(device).GetStdAllocator().GetInterface().Allocate((device).GetStdAllocator().GetInterface().userArg, (elementNum) * sizeof(T), alignof(T)) \
: (T*)Align((elementNum) ? (T*)alloca(((elementNum) * sizeof(T) + alignof(T))) : nullptr, alignof(T)), \
(elementNum) }
(elementNum)}

0 comments on commit 8463059

Please sign in to comment.