On Tue, Apr 12, 2011 at 08:45:34AM -0700, Jason Gerecke wrote: > On Mon, Apr 11, 2011 at 6:15 PM, Peter Hutterer > <[email protected]> wrote: > > > > Signed-off-by: Peter Hutterer <[email protected]> > > --- > > > >> I could remove WCM_LCD from the definition of WCM_TPC but I think the > >> more correct fix would actually be changing TabletHasFeature(common, > >> feature): > >> > >> from > >> > >> (((common->tablet_type) & (feature)) != 0) > >> > >> to > >> > >> (((common->tablet_type) & (feature)) == feature) > >> > >> I'll be working on some other patches first in case anybody wants to > >> give some more feedback. > > > > I've had this patch in my devel tree for a while but haven't started using > > it yet. Was born of the same problem that the == 0 check didn't cover what I > > needed at the time. Maybe we should use these instead. > > > > src/xf86WacomDefs.h | 14 ++++++++++++++ > > test/wacom-tests.c | 21 +++++++++++++++++++++ > > 2 files changed, 35 insertions(+), 0 deletions(-) > > > > diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h > > index cae441c..9063fc0 100644 > > --- a/src/xf86WacomDefs.h > > +++ b/src/xf86WacomDefs.h > > @@ -104,6 +104,20 @@ > > #define OFF(x) ((x)%BITS_PER_LONG) > > #define LONG(x) ((x)/BITS_PER_LONG) > > > > +/** > > + * Test if the mask is set in the given bitfield. > > + * @return TRUE if set or FALSE otherwise. > > + */ > > +#define MaskIsSet(bitfield, mask) !!(((bitfield) & (mask)) == (mask)) > > +/** > > + * Set the given mask for the given bitfield. > > + */ > > +#define MaskSet(bitfield, mask) ((bitfield) |= (mask)) > > +/** > > + * Clear the given mask from the given bitfield > > + */ > > +#define MaskClear(bitfield, mask) ((bitfield) &= ~(mask)) > > + > > /****************************************************************************** > > * Forward Declarations > > *****************************************************************************/ > > diff --git a/test/wacom-tests.c b/test/wacom-tests.c > > index 42a7557..e0891ae 100644 > > --- a/test/wacom-tests.c > > +++ b/test/wacom-tests.c > > @@ -531,6 +531,26 @@ static void test_set_type(void) > > #undef reset > > } > > > > +static int test_flag_set(void) > > +{ > > + int i; > > + unsigned int flags = 0; > > + > > + for (i = 0; i < sizeof(flags); i++) > > + { > > + int mask = 1 << i; > > + flags = 0; > > + > > + assert(!MaskIsSet(flags, mask)); > > + MaskSet(flags, mask); > > + assert(flags != 0); > > + assert(MaskIsSet(flags, mask)); > > + MaskClear(flags, mask); > > + assert(!MaskIsSet(flags, mask)); > > + assert(flags == 0); > > + } > > +} > > + > > int main(int argc, char** argv) > > { > > test_common_ref(); > > @@ -541,6 +561,7 @@ int main(int argc, char** argv) > > test_tilt_to_rotation(); > > test_mod_buttons(); > > test_set_type(); > > + test_flag_set(); > > return 0; > > } > > > > -- > > 1.7.4.2 > > > > Those look solid to me, and I'd be fine with them migrating their way > out of development. :)
I've moved them into the next branch locally, will be merged into master after 0.11. Cheers, Peter ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ Linuxwacom-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
