Re: [dev] [st] [PATCH] Explicit cast in CEIL macro

From: Alexander S. <alex0player_AT_gmail.com>
Date: Wed, 25 Jun 2014 04:13:23 +0400

2014-06-24 23:16 GMT+04:00 Roberto E. Vargas Caballero <k0ga_AT_shike2.com>:
>> But who'd specify a scaling factor of 1.99999 or sth.?
>> BTW: Casting to int yields the exact same results for both CEIL and
>> ceilf in my setup.
>
> There is an implicit casting because xw.cw and xw.ch are integers,
> so the explicit casting is redundant. This macro is used only in one place,
> xloadfonts, that is out of the main loop (usually is only called in
> the init process), so it is a waste of time try to optimize it for speed.
> A macro like:
>
> CEIL(x) ((int)(x) + ((x) > 0 && (int)(x) != (x)))
>
> Can take more bytes that the direct call to ceilf because it has
> only one parameter, so the calling sequence is short, and in case of
> being and inlined function, the compiler version will be better
> that our version, so my proposal for the patch is:
Greetings,
I would vote to drop the macro, because supporting it for future
use-cases can be a nightmare. What to use for ceiliing in those
calculations is another matter... we could always just add 1 -
FLT_EPSILON and call it a day.
Received on Wed Jun 25 2014 - 02:13:23 CEST

This archive was generated by hypermail 2.3.0 : Wed Jun 25 2014 - 02:24:07 CEST