[Mesa-dev] Fixup: Use C++ style constant member functions for is_one and is_zero.

Tolga Dalman tolga.dalman at googlemail.com
Sun Sep 11 04:05:38 PDT 2011


Hi Kenneth,

On Fri,  9 Sep 2011 14:41:45 -0700
Kenneth Graunke <kenneth at whitecape.org> wrote:

> -   if (reg->type == BRW_REGISTER_TYPE_F) {
> -      return reg->imm.f == 0.0;
> +   if (type == BRW_REGISTER_TYPE_F) {
> +      return imm.f == 0.0;
[...]
> -   if (reg->type == BRW_REGISTER_TYPE_F) {
> -      return reg->imm.f == 1.0;
> +   if (type == BRW_REGISTER_TYPE_F) {
> +      return imm.f == 1.0;

Shouldn't this rather be something like
fabs(imm.f - 1.0) < std::numeric_limits<float>::eps() ?

Nevertheless, I like your patch.

Best regards
Tolga Dalman




More information about the mesa-dev mailing list