diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-17 23:23:32 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-11-17 23:23:32 +0000 |
commit | 11f73970236f910a63ff77fbc8e2ee4a8ee23bc3 (patch) | |
tree | 5f765fa3f87643d73016838a6a219e83c5364e32 /include/hashcomp.h | |
parent | 3f1e3f22b57e934481193811d878dafb4c78691d (diff) |
Add irc::dynamicbitmask class. Feel free to take a look and offer suggestions, as far as i can tell its about as efficient as im going to make it.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5757 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/hashcomp.h')
-rw-r--r-- | include/hashcomp.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/hashcomp.h b/include/hashcomp.h index 11a491d62..4a5dd72ad 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -358,6 +358,26 @@ namespace irc long GetToken(); }; + typedef std::pair<size_t, unsigned char> bitfield; + + class dynamicbitmask : public classbase + { + private: + unsigned char* bits; + unsigned char* freebits; + size_t bits_size; + public: + dynamicbitmask(); + + ~dynamicbitmask(); + + bitfield Allocate(); + + bool Deallocate(bitfield &pos); + + void Toggle(bitfield &pos, bool state); + }; + /** The irc_char_traits class is used for RFC-style comparison of strings. * This class is used to implement irc::string, a case-insensitive, RFC- * comparing string class. |