Re: Bitvectors

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/23/97

On Tue, 23 Sep 1997, Daniel Koepke wrote:

>Huh?  CircleMUD already uses all 32 bits, even though the 32nd is
>often signed (eg., turns everything negative when set).  That's what
>the "bitvector < 0" check is for in sprintbit().  Changing them to
>unsigned will clarify it for coders universally (although not many
>newbies even understand bitvectors).  Unless I'm misunderstanding...?

void sprintbit(long bitvector, char *names[], char *result)
  long nr;

  *result = '\0';

  if (bitvector < 0) {
    strcpy(result, "<INVALID BITVECTOR>");

You can't use the last bitvector if your 'long' defaults to signed.
Therefore you only get 31 possible flags instead of 32.
(I of course made it unsigned long int as a typedef ush_long)

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/08/00 PST