mirror of https://github.com/bjornbytes/lovr.git
Only use CTZL in audio;
This commit is contained in:
parent
bff86e6add
commit
1d1a2de124
|
@ -14,13 +14,11 @@
|
|||
#define LOVR_THREAD_LOCAL __declspec(thread)
|
||||
#define LOVR_ALIGN(n) __declspec(align(n))
|
||||
#define LOVR_RESTRICT __restrict
|
||||
#define LOVR_CTZLL _tzcnt_u64
|
||||
#else
|
||||
#define LOVR_NORETURN __attribute__((noreturn))
|
||||
#define LOVR_THREAD_LOCAL __thread
|
||||
#define LOVR_ALIGN(n) __attribute__((aligned(n)))
|
||||
#define LOVR_RESTRICT restrict
|
||||
#define LOVR_CTZLL __builtin_ctzll
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
|
|
|
@ -6,13 +6,19 @@
|
|||
#include "lib/miniaudio/miniaudio.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef _MSVC_VER
|
||||
#include <intrin.h>
|
||||
#define CTZL _tzcnt_u64
|
||||
#else
|
||||
#define CTZL __builtin_ctzl
|
||||
#endif
|
||||
|
||||
static const ma_format miniaudioFormats[] = {
|
||||
[SAMPLE_I16] = ma_format_s16,
|
||||
[SAMPLE_F32] = ma_format_f32
|
||||
};
|
||||
|
||||
#define FOREACH_SOURCE(s) for (uint64_t m = state.sourceMask; s = m ? state.sources[LOVR_CTZLL(m)] : NULL, m; m ^= (m & -m))
|
||||
#define FOREACH_SOURCE(s) for (uint64_t m = state.sourceMask; s = m ? state.sources[CTZL(m)] : NULL, m; m ^= (m & -m))
|
||||
#define OUTPUT_FORMAT SAMPLE_F32
|
||||
#define OUTPUT_CHANNELS 2
|
||||
#define CAPTURE_CHANNELS 1
|
||||
|
@ -398,7 +404,7 @@ bool lovrSourcePlay(Source* source) {
|
|||
|
||||
// If the source isn't tracked, set its index to the right-most zero bit in the mask
|
||||
if (source->index == ~0u) {
|
||||
uint32_t index = state.sourceMask ? LOVR_CTZLL(~state.sourceMask) : 0;
|
||||
uint32_t index = state.sourceMask ? CTZL(~state.sourceMask) : 0;
|
||||
state.sourceMask |= (1ull << index);
|
||||
state.sources[index] = source;
|
||||
source->index = index;
|
||||
|
|
Loading…
Reference in New Issue