From 11f73970236f910a63ff77fbc8e2ee4a8ee23bc3 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 17 Nov 2006 23:23:32 +0000 Subject: 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 --- include/hashcomp.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'include') 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 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. -- cgit v1.2.3