aboutsummaryrefslogtreecommitdiffstats
path: root/al/buffer.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-01 18:07:16 -0700
committerChris Robinson <[email protected]>2019-09-01 18:07:16 -0700
commit3d7ce5a86010240262bdd1763218b3beeda21c5e (patch)
treef42168fdf8df27bccb48f4e395d22705b4449219 /al/buffer.cpp
parentbb35e24c9ba7ec01c05fc1f07ef737c15821283a (diff)
Use global placement new for AL object batches
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r--al/buffer.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp
index df2496cb..03b68038 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -254,13 +254,9 @@ ALbuffer *AllocBuffer(ALCcontext *context)
);
auto lidx = static_cast<ALsizei>(std::distance(device->BufferList.begin(), sublist));
- ALbuffer *buffer{nullptr};
ALsizei slidx{0};
if LIKELY(sublist != device->BufferList.end())
- {
slidx = CTZ64(sublist->FreeMask);
- buffer = sublist->Buffers + slidx;
- }
else
{
/* Don't allocate so many list entries that the 32-bit ID could
@@ -283,10 +279,10 @@ ALbuffer *AllocBuffer(ALCcontext *context)
}
slidx = 0;
- buffer = sublist->Buffers + slidx;
}
- buffer = new (buffer) ALbuffer{};
+ ALbuffer *buffer{::new (sublist->Buffers + slidx) ALbuffer{}};
+
/* Add 1 to avoid buffer ID 0. */
buffer->id = ((lidx<<6) | slidx) + 1;