Evas: faster "lround"
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 13 Oct 2011 06:55:12 +0000 (06:55 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 13 Oct 2011 06:55:12 +0000 (06:55 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@64036 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/include/evas_common.h

index 726790c..6d68240 100644 (file)
 #include <unistd.h>
 
 #ifndef HAVE_LROUND
-// right now i dont care about rendering bugs on platforms without lround
-// (e.g. windows/vc++... yay!)
-#define lround(x) ((long int)(x + (x / (2.0 * abs(x)))))
+/* right now i dont care about rendering bugs on platforms without lround
+ (e.g. windows/vc++... yay!)
+ FIXME: http://cgit.freedesktop.org/cairo/tree/src/cairo-misc.c#n487
+*/
+#define lround(x) (((x) < 0) ? (long int)ceil((x) - 0.5) : (long int)floor((x) + 0.5))
 #endif
 
 /* macros needed to log message through eina_log */