Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_object.c ewl_object.h 


Log Message:
- convert the flag checks to macros. gives a pretty good speed boost (up to
  20% improvement in some cases)

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_object.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_object.c        5 Mar 2007 13:29:21 -0000       1.19
+++ ewl_object.c        5 Mar 2007 22:50:16 -0000       1.20
@@ -1440,50 +1440,3 @@
        DRETURN_INT(ewl_object_flags_get(o, EWL_FLAGS_FILL_MASK), 
DLEVEL_STABLE);
 }
 
-/**
- * @param o: the parameter to retrieve the current value of object flags
- * @param mask: get only the flags specified in mask
- * @return Returns the current setting of the object flags for @a o.
- * @brief Retrieves the current setting of the object flags for @a o.
- */
-unsigned int ewl_object_flags_get(Ewl_Object *o, unsigned int mask)
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("o", o, 0);
-
-       DRETURN_INT(o->flags & mask, DLEVEL_STABLE);
-}
-
-/**
- * @param o: the object to check for a specified flags
- * @param flags: the bitmask of flags to check on the object
- * @param mask: get only the flags specified in mask
- * @return Returns TRUE if any of the specified flags are set, FALSE otherwise.
- * @brief Determines if an object has the requested @a flags set.
- */
-unsigned int
-ewl_object_flags_has(Ewl_Object *o, unsigned int flags, unsigned int mask)
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("o", o, 0);
-
-       DRETURN_INT(!!(o->flags & (flags & mask)), DLEVEL_STABLE);
-}
-
-/**
- * @param o: the object to check for a specified flags
- * @param flags: the bitmask of flags to check on the object
- * @param mask: get only the flags specified in mask
- * @return Returns TRUE if the specified flags are set, FALSE otherwise.
- * @brief Determines if an object has all of the requested @a flags set.
- */
-unsigned int
-ewl_object_flags_has_all(Ewl_Object *o, unsigned int flags, unsigned int mask)
-{
-       DENTER_FUNCTION(DLEVEL_STABLE);
-       DCHECK_PARAM_PTR_RET("o", o, 0);
-
-       DRETURN_INT((o->flags & (flags & mask)) == (flags & mask),
-                       DLEVEL_STABLE);
-}
-
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_object.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- ewl_object.h        5 Mar 2007 13:29:21 -0000       1.19
+++ ewl_object.h        5 Mar 2007 22:50:16 -0000       1.20
@@ -175,11 +175,35 @@
                                     unsigned int mask);
 void           ewl_object_flags_remove(Ewl_Object *o, unsigned int flags,
                                        unsigned int mask);
-unsigned int    ewl_object_flags_has(Ewl_Object *o, unsigned int flags,
-                                    unsigned int mask);
-unsigned int    ewl_object_flags_has_all(Ewl_Object *o, unsigned int flags,
-                                    unsigned int mask);
-unsigned int    ewl_object_flags_get(Ewl_Object *o, unsigned int mask);
+
+/**
+ * @param o: the parameter to retrieve the current value of object flags
+ * @param mask: get only the flags specified in mask
+ * @return Returns the current setting of the object flags for @a o.
+ * @brief Retrieves the current setting of the object flags for @a o.
+ */
+#define ewl_object_flags_get(o, mask) \
+       (EWL_OBJECT(o)->flags & mask)
+
+/**
+ * @param o: the object to check for a specified flags
+ * @param check_flags: the bitmask of flags to check on the object
+ * @param mask: get only the flags specified in mask
+ * @return Returns TRUE if any of the specified flags are set, FALSE otherwise.
+ * @brief Determines if an object has the requested @a flags set.
+ */
+#define ewl_object_flags_has(o, check_flags, mask) \
+       (!!(EWL_OBJECT(o)->flags & (check_flags & mask)))
+
+/**
+ * @param o: the object to check for a specified flags
+ * @param check_flags: the bitmask of flags to check on the object
+ * @param mask: get only the flags specified in mask
+ * @return Returns TRUE if the specified flags are set, FALSE otherwise.
+ * @brief Determines if an object has all of the requested @a flags set.
+ */
+#define ewl_object_flags_has_all(o, check_flags, mask) \
+       ((EWL_OBJECT(o)->flags & (check_flags & mask)) == (check_flags & mask))
 
 /**
  * @def ewl_object_recursive_set(o)



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to