linux-sunxi / libvdpau-sunxi

Experimental VDPAU for Allwinner sunxi SoCs (obsolete, see https://linux-sunxi.org/Sunxi-Cedrus)
https://linux-sunxi.org/Cedrus
166 stars 80 forks source link

typo in rgba.c rgba_clear #29

Closed daym closed 10 years ago

daym commented 10 years ago

Fixed by

@@ -226,7 +231,7 @@ void rgba_clear(rgba_surface_t *rgba)
                return;

        rgba_fill(rgba, &rgba->dirty, 0x00000000);
-       rgba->flags &= ~(RGBA_FLAG_DIRTY || RGBA_FLAG_NEEDS_CLEAR);
+       rgba->flags &= ~(RGBA_FLAG_DIRTY | RGBA_FLAG_NEEDS_CLEAR);
Moorviper commented 10 years ago

why is it a typo?? Logical Or Operator = || Bitwise Or Operator = |

i think the logical should be used

daym commented 10 years ago

why is it a typo??

(~) is a bitwise operator (which does inversion). It makes little sense to mix bitwise (~) and logical (||) in that fashion.

Also, doing &~(a|b) is a common idiom to clear the stated flags while &~(a||b) is senseless (would always clear bit 0 - if a or b is not equal to 0, which is the case).

i think the logical should be used

Why do you think that?

rellla commented 10 years ago

daym seems to be right. fixed with 1a41433da20b660aff71546ba235009f14b088e7