mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
spa: audioconvert: use unsigned 64-bit integer for creating divisor
Using `int` results in UndefinedBehaviorSanitizer errors when `noise::intensity` is 31 as that would shift the 1 into the sign bit of a signed integer type.
This commit is contained in:
parent
43f7831d14
commit
bb205d3d85
1 changed files with 2 additions and 1 deletions
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <spa/param/audio/format-utils.h>
|
#include <spa/param/audio/format-utils.h>
|
||||||
|
|
@ -71,7 +72,7 @@ int noise_init(struct noise *ns)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
|
|
||||||
for (i = 0; i < SPA_N_ELEMENTS(ns->tab); i++)
|
for (i = 0; i < SPA_N_ELEMENTS(ns->tab); i++)
|
||||||
ns->tab[i] = (drand48() - 0.5) / (1 << ns->intensity);
|
ns->tab[i] = (drand48() - 0.5) / (UINT64_C(1) << ns->intensity);
|
||||||
|
|
||||||
ns->free = impl_noise_free;
|
ns->free = impl_noise_free;
|
||||||
ns->process = info->process;
|
ns->process = info->process;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue