This makes accounting of number of bits allocated easier. Specifically, the amount of allocated
bits is computed by doing (index->highest_bit - 1) in code.
entry = irc_dictionary_retrieve(index->cap_dict, cap);
if (entry != NULL && !(entry->flags & CAP_ORPHANED))
entry = irc_dictionary_retrieve(index->cap_dict, cap);
if (entry != NULL && !(entry->flags & CAP_ORPHANED))
+ return (1 << entry->value);
struct CapabilityEntry *entry;
s_assert(index != NULL);
struct CapabilityEntry *entry;
s_assert(index != NULL);
+ if (!index->highest_bit)
+ return 0xFFFFFFFF;
if ((entry = irc_dictionary_retrieve(index->cap_dict, cap)) != NULL)
{
entry->flags &= ~CAP_ORPHANED;
if ((entry = irc_dictionary_retrieve(index->cap_dict, cap)) != NULL)
{
entry->flags &= ~CAP_ORPHANED;
+ return (1 << entry->value);
}
entry = rb_malloc(sizeof(struct CapabilityEntry));
}
entry = rb_malloc(sizeof(struct CapabilityEntry));
irc_dictionary_add(index->cap_dict, entry->cap, entry);
irc_dictionary_add(index->cap_dict, entry->cap, entry);
- index->highest_bit <<= 1;
+ index->highest_bit++;
+ if (index->highest_bit % (sizeof(unsigned int) * 8) == 0)
+ index->highest_bit = 0;
- /* hmm... not sure what to do here, so i guess we will abort for now... --nenolod */
- if (index->highest_bit == 0)
- abort();
-
- return entry->value;
+ return (1 << entry->value);
DICTIONARY_FOREACH(entry, &iter, index->cap_dict)
{
if (!(entry->flags & CAP_ORPHANED))
DICTIONARY_FOREACH(entry, &iter, index->cap_dict)
{
if (!(entry->flags & CAP_ORPHANED))
+ mask |= (1 << entry->value);
DICTIONARY_FOREACH(entry, &iter, index->cap_dict)
{
if (!(entry->flags & CAP_ORPHANED) && (entry->flags & CAP_REQUIRED))
DICTIONARY_FOREACH(entry, &iter, index->cap_dict)
{
if (!(entry->flags & CAP_ORPHANED) && (entry->flags & CAP_REQUIRED))
+ mask |= (1 << entry->value);