On Mon, Mar 21, 2011 at 9:16 PM, Peter Hutterer
<[email protected]> wrote:
> +/**
> + * Flip the mask bit in buttons corresponding to btn to the specified state.
> + *
> + * @param buttons The current button mask
> + * @param btn Zero-indexed button number to change
> + * @param state Zero to unset, non-zero to set the mask for the button
> + *
> + * @return The new button mask
> + */
> +static int mod_buttons(int buttons, int btn, int state)
> +{
> +       int mask = 1 << btn;
> +
> +       if (btn >= sizeof(int))
> +       {
> +               xf86Msg(X_ERROR, "%s: Invalid button number %d. Insufficient "
> +                               "storage\n", __func__, btn);
> +               return buttons;
> +       }
> +
> +       if (state)
> +               buttons |= mask;
> +       else
> +               buttons &= ~mask;
> +
> +       return buttons;
> +}
>

Would it be too nitpicky of me to want the shift occuring after the
test? I do prefer it when functions fail as fast as possible...

Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to