Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Sogou

Members: 0
Guests: 8
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Extended Bitvectors
Forum Rules | Mark all | Recent Posts

Extended Bitvectors
< Newer Topic :: Older Topic > *Points up*

Pages:<< prev 1 next >>
Post is unread #1 Jan 28, 2003, 8:07 pm
Go to the top of the page
Go to the bottom of the page

Cray
Member
GroupMembers
Posts9
JoinedDec 20, 2002

This is more so of a knowledge question, and not a "how to" question.

After about 2 hours of installing Extended Bitvectors, and changing all the tedius references in the code, i was just curious.

How many bits do you actually get for all that work?

Rather simple question huh? :lol:
       
Post is unread #2 Jan 28, 2003, 8:14 pm
Go to the top of the page
Go to the bottom of the page

Orion
Master Member
GroupMembers
Posts35
JoinedNov 12, 2002

I've heard it stated that you get 128... I looked over the code and it appears that extended bits are an array of four long ints, each int being able to store 32 bits. If my understanding was correct, it would store 128 bits maximum. However, if that is how it works you could extend it FAR beyond that I would guess.

But, my understanding is probably flawed and is based upon me glancing at the code once a lot of months ago. ;)
       
Post is unread #3 Jan 29, 2003, 11:59 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

I beleieve it is in fact theoretically infinite depending on how far you want to go with it. But 128 BVs should be more than you'll ever need to deal with a particular set of flags.
       
Post is unread #4 Jan 30, 2003, 2:54 pm
Go to the top of the page
Go to the bottom of the page

Garil

GroupMembers
Posts9
JoinedDec 24, 2003

That's right, and 640k should be enough for anybody...

Sorry, couldn't resist. ;)
       
Post is unread #5 Jan 31, 2003, 5:28 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Heh. That brings back memories.....

"Hey wow! You have 4MB on that thing? What will you ever need that much RAM for?!?!"

"Good Lord! You put a 60MB hard drive in there? Why? DOS only needs a few hundred KB!"

And the list could go on.... I miss those days. Now you're lucky if you can get by on a 20GB drive and 256MB RAM if you want to do anything meaningful with a computer :/ ( Windows based that is )
       
Post is unread #6 Feb 1, 2003, 5:52 pm
Go to the top of the page
Go to the bottom of the page

Ddruid
Member
GroupMembers
Posts11
JoinedNov 17, 2002

I was using some Public Domain code for dynamic BV's. It seemed to work pretty good and I tested it up to 400 flags without any problems. I never did get the authors name, but if there is interest I'll poke arround and see if I can't come up with the code again.
       
Post is unread #7 Feb 5, 2003, 5:23 pm
Go to the top of the page
Go to the bottom of the page

Ddruid
Member
GroupMembers
Posts11
JoinedNov 17, 2002

/* +++Date last modified: 05-Jul-1997 */

/*
**  Functions to maintain an arbitrary length array of bits
*/

/*#include "bitops.h"*/
#include <limits.h>

char *alloc_bit_array(size_t bits)
{
      char *set = calloc((bits + CHAR_BIT - 1) / CHAR_BIT, sizeof(char));

      return set;
}

int getbit(char *set, int number)
{
        set += number / CHAR_BIT;
        return (*set & (1 << (number % CHAR_BIT))) != 0;    /* 0 or 1   */
}

void setbit(char *set, int number, int value)
{
        set += number / CHAR_BIT;
        if (value)
                *set |= 1 << (number % CHAR_BIT);           /* set bit  */
        else    *set &= ~(1 << (number % CHAR_BIT));        /* clear bit*/
}

void flipbit(char *set, int number)
{
        set += number / CHAR_BIT;
        *set ^= 1 << (number % CHAR_BIT);                   /* flip bit */ 


The only problem it posed to me was how to read and write the bits to a file since it uses a character pointer, I ended up writing to the file as if it was a binary number '01011010101' and read them back the same way.
       
Pages:<< prev 1 next >>