diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-01-16 01:09:01 +0400 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-10-15 20:00:28 +0400 |
commit | c0085f94fea89b180e5727b193484a83586d3490 (patch) | |
tree | e802e02b3ddea402430e7338b884de9d31831657 /libavcodec/mpegaudio_tablegen.h | |
parent | 479a52795526a5ad6628e37d9614dee5e32dc773 (diff) |
mpegaudio_tablegen: Don't use llrint
You cannot count on it being present on all systems, and you
cannot include libm.h in a host tool, so just hard code a baseline
implementation.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/mpegaudio_tablegen.h')
-rw-r--r-- | libavcodec/mpegaudio_tablegen.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index a6c203ff3b..8a3e51ae60 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -61,7 +61,8 @@ static void mpegaudio_tableinit(void) for (value = 0; value < 16; value++) { /* cbrtf() isn't available on all systems, so we use powf(). */ double f = (double)value * powf(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5); - expval_table_fixed[exponent][value] = llrint(f); + /* llrint() isn't always available, so round and cast manually. */ + expval_table_fixed[exponent][value] = (long long int) (f >= 0 ? floor(f + 0.5) : ceil(f - 0.5)); expval_table_float[exponent][value] = f; } exp_table_fixed[exponent] = expval_table_fixed[exponent][1]; |