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 <[email protected]> --- libavcodec/cos_tablegen.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libavcodec/cos_tablegen.c b/libavcodec/cos_tablegen.c index 197de1d..5929081 100644 --- a/libavcodec/cos_tablegen.c +++ b/libavcodec/cos_tablegen.c @@ -37,11 +37,15 @@ static int clip_f15(int v) static void printval(double val, int fixed) { - if (fixed) - printf(" "FIXEDFMT",", clip_f15(lrint(val * (double)(1<<15)))); - else - printf(" "FLOATFMT",", val); + if (fixed) { + double new_val = val * (double) (1 << 15); + + new_val = new_val >= 0 ? floor(new_val + 0.5) : ceil(new_val - 0.5); + printf(" "FIXEDFMT",", clip_f15((long int) new_val)); + } else { + printf(" "FLOATFMT",", val); + } } int main(int argc, char *argv[]) -- 1.7.10.4 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
