mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: optimization: PVS-Studio warning V831
Replaced 'at()' method with 'operator[]' to improve performance. The 'at()' method performs bounds checking, which can introduce overhead. Using 'operator[]' bypasses this check and can improve performance when you are certain that the index is within bounds. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
parent
97a0bb5776
commit
8c5e5559ec
6 changed files with 8 additions and 8 deletions
|
|
@ -253,7 +253,7 @@ speakerid_t audio::play(
|
|||
if (!sound->variants.empty()) {
|
||||
size_t index = rand() % (sound->variants.size() + 1);
|
||||
if (index < sound->variants.size()) {
|
||||
sound = sound->variants.at(index).get();
|
||||
sound = sound->variants[index].get();
|
||||
}
|
||||
}
|
||||
auto speaker_ptr = sound->newInstance(priority, channel);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue