1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

cos_tablegen: Don't use lrint

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>
This commit is contained in:
Derek Buitenhuis 2013-01-15 16:09:00 -05:00
parent bc31a7a3b6
commit 479a527955

View File

@ -37,11 +37,16 @@ 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) {
/* lrint() isn't always available, so round and cast manually. */
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[])