Revision: 1879
          
http://undernet-ircu.svn.sourceforge.net/undernet-ircu/?rev=1879&view=rev
Author:   klmitch
Date:     2008-09-20 02:32:51 +0000 (Sat, 20 Sep 2008)

Log Message:
-----------
Author: Kev <[EMAIL PROTECTED]>
Description:

Beginning to set-up the new mode system.  Here, did a little bit of work
on flagset.h, which will be used to define a mode set--a set of mode
switches.

Modified Paths:
--------------
    ircu2/branches/mode/ChangeLog
    ircu2/branches/mode/include/flagset.h

Modified: ircu2/branches/mode/ChangeLog
===================================================================
--- ircu2/branches/mode/ChangeLog       2008-09-19 16:04:55 UTC (rev 1878)
+++ ircu2/branches/mode/ChangeLog       2008-09-20 02:32:51 UTC (rev 1879)
@@ -1,3 +1,9 @@
+2008-09-19  Kevin L. Mitchell  <[EMAIL PROTECTED]>
+
+       * include/flagset.h: we declared flagpage_t, then never used
+       it--fixed; add FlagZero() and FlagSwap() to zero a flagset and
+       swap the values of 2 flagsets
+
 2008-03-27  Kevin L. Mitchell  <[EMAIL PROTECTED]>
 
        * ircd/watch.c: implementation of generic watch subsystem

Modified: ircu2/branches/mode/include/flagset.h
===================================================================
--- ircu2/branches/mode/include/flagset.h       2008-09-19 16:04:55 UTC (rev 
1878)
+++ ircu2/branches/mode/include/flagset.h       2008-09-20 02:32:51 UTC (rev 
1879)
@@ -37,7 +37,7 @@
 #define DECLARE_FLAGSET(name,max) \
   struct name \
   { \
-    unsigned long bits[((max + FLAGSET_NBITS - 1) / FLAGSET_NBITS)]; \
+    flagpage_t bits[((max + FLAGSET_NBITS - 1) / FLAGSET_NBITS)]; \
   }
 
 /** Test whether a flag is set in a flagset. */
@@ -47,4 +47,24 @@
 /** Clear a flag in a flagset. */
 #define FlagClr(set,flag) ((set)->bits[FLAGSET_INDEX(flag)] &= 
~FLAGSET_MASK(flag))
 
+/** Zero a flagset. */
+#define FlagZero(set,max) \
+  do { \
+    unsigned int _max = FLAGSET_INDEX(max), _i; \
+    for (_i = 0; _i < _max; _i++) \
+      (set)->bits[_i] = 0; \
+  } while (0)
+
+/** Swap two flagsets. */
+#define FlagSwap(s1,s2,max) \
+  do { \
+    unsigned int _max = FLAGSET_INDEX(max), _i; \
+    flagpage_t _tmp; \
+    for (_i = 0; _i < _max; _i++) { \
+      _tmp = (s1)->bits[_i]; \
+      (s1)->bits[_i] = (s2)->bits[_i]; \
+      (s2)->bits[_i] = _tmp; \
+    } \
+  } while (0)
+
 #endif /* ndef INCLUDED_flagset_h */


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to