From 1f236d8f204c66a5c0a1885b6893d6cb8b0c289d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 11 Jan 2018 22:42:25 -0800 Subject: Define a function where it's used --- Alc/backends/mmdevapi.c | 7 +++++++ Alc/helpers.c | 3 --- OpenAL32/Include/alMain.h | 18 ------------------ 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c index ecd7eb5d..9604d0f9 100644 --- a/Alc/backends/mmdevapi.c +++ b/Alc/backends/mmdevapi.c @@ -71,6 +71,13 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #define DEVNAME_HEAD "OpenAL Soft on " +/* Scales the given value using 64-bit integer math, ceiling the result. */ +static inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) +{ + return (val*new_scale + old_scale-1) / old_scale; +} + + typedef struct { al_string name; al_string endpoint_guid; // obtained from PKEY_AudioEndpoint_GUID , set to "Unknown device GUID" if absent. diff --git a/Alc/helpers.c b/Alc/helpers.c index 238569d6..5d39f3d8 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -120,9 +120,6 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x extern inline ALuint NextPowerOf2(ALuint value); extern inline size_t RoundUp(size_t value, size_t r); -extern inline ALuint64 ScaleRound(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale); -extern inline ALuint64 ScaleFloor(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale); -extern inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale); extern inline ALint fastf2i(ALfloat f); diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 7706d598..76624a66 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -306,24 +306,6 @@ inline size_t RoundUp(size_t value, size_t r) return value - (value%r); } -/* Scales the given value using 64-bit integer math, rounding the result. */ -inline ALuint64 ScaleRound(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) -{ - return (val*new_scale + old_scale/2) / old_scale; -} - -/* Scales the given value using 64-bit integer math, flooring the result. */ -inline ALuint64 ScaleFloor(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) -{ - return val * new_scale / old_scale; -} - -/* Scales the given value using 64-bit integer math, ceiling the result. */ -inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) -{ - return (val*new_scale + old_scale-1) / old_scale; -} - /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero * mode. */ inline ALint fastf2i(ALfloat f) -- cgit v1.2.3