On Fri, May 29, 2015 at 12:33 PM, Chad Versace <chad.vers...@intel.com> wrote: > On Fri 29 May 2015, Matt Turner wrote: >> On Thu, May 28, 2015 at 10:21 AM, Ben Widawsky >> > @@ -286,7 +284,7 @@ intel_miptree_create_layout(struct brw_context *brw, >> > mt->logical_height0 = height0; >> > mt->logical_depth0 = depth0; >> > mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_NO_MCS; >> > - mt->disable_aux_buffers = disable_aux_buffers; >> > + mt->disable_aux_buffers = !!(layout_flags & >> > MIPTREE_LAYOUT_DISABLE_AUX); >> >> FWIW, I much prefer (x & y) != 0 to !!(x & y). > > Matt, in the C code you've encountered in the wild, do you feel that > `(x & y) != 0` is more prevalent than `!!(x & y)`? I'm curious, because > we should probably choose the idiom which is more recognizable. > > For the record, I slightly prefer !! because I've encountered it often > in idiomatic Python, but it really doesn't matter to me. I suspect that > != 0 may be the more common idiom in C.
My quick grepping convinces me that (x & y) != 0 is a lot more common than !!(x & y) in mesa (outside of the freedreno driver). I think the first is cleaner since there aren't any implicit conversions. With !!, the operators aren't even doing the same thing: the first ! is doing an implicit conversion from int to bool and inverting, and the second is just inverting. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev