[PATCH] winepulse.drv: Avoid unnecessary use of ceil function

Andrew Eikum aeikum at codeweavers.com
Wed Dec 5 07:34:46 CST 2018


I guess I'm not opposed to this, but my feeling is "if it's not
broken, don't fix it". Maybe there's something I don't know. Can you
explain what advantage this has?

Thanks,
Andrew

On Sun, Dec 02, 2018 at 04:09:34PM -0700, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> ---
>  dlls/winepulse.drv/mmdevdrv.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c
> index 8d57f1a45a..0823af6341 100644
> --- a/dlls/winepulse.drv/mmdevdrv.c
> +++ b/dlls/winepulse.drv/mmdevdrv.c
> @@ -28,7 +28,6 @@
>  
>  #include <stdarg.h>
>  #include <unistd.h>
> -#include <math.h>
>  #include <stdio.h>
>  #include <errno.h>
>  
> @@ -1400,7 +1399,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
>      period_bytes = pa_frame_size(&This->ss) * MulDiv(period, This->ss.rate, 10000000);
>  
>      if (duration < 20000000)
> -        This->bufsize_frames = ceil((duration / 10000000.) * fmt->nSamplesPerSec);
> +        This->bufsize_frames = (duration * fmt->nSamplesPerSec + 9999999) / 10000000;
>      else
>          This->bufsize_frames = 2 * fmt->nSamplesPerSec;
>      This->bufsize_bytes = This->bufsize_frames * pa_frame_size(&This->ss);
> -- 
> 2.19.2
> 



More information about the wine-devel mailing list