From f815ec6801a6809b4abe49bbc03cff86f7024c64 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Fri, 11 Jan 2019 18:09:20 +0000 Subject: [PATCH] Truncate rather than floor when casting from float to int --- libvips/conversion/cast.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index abdc8327..21078ae3 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -195,9 +195,7 @@ G_DEFINE_TYPE( VipsCast, vips_cast, VIPS_TYPE_CONVERSION ); OTYPE * restrict q = (OTYPE *) out; \ \ for( x = 0; x < sz; x++ ) { \ - TEMP v = VIPS_FLOOR( p[x] ); \ - \ - q[x] = CAST( v ); \ + q[x] = CAST( p[x] ); \ } \ }