X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=misc.c;h=7dfa74298e79c5264884520329fd7f4e9bc6d43d;hp=365d7c88eb21ffba77f6e4f715195c6c7820d81f;hb=aef609291dd382447c9edbe7717d127485a9ab4f;hpb=63f53c026d42fec1ae0421e47b9c68a5ae5e8731 diff --git a/misc.c b/misc.c index 365d7c8..7dfa742 100644 --- a/misc.c +++ b/misc.c @@ -631,26 +631,14 @@ L2: AT=I; /* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value, * randrange, RNDVOC, BUG) */ -long SETBIT(long BIT) { -long I, IND; - +long SETBIT(long bit) { /* Returns 2**bit for use in constructing bit-masks. */ - - IND=1; - if(BIT <= 0)return(IND); - for (I=1; I<=BIT; I++) { - IND=IND+IND; - } /* end loop */ - return(IND); + 2 << bit; } - - -long TSTBIT(long MASK, long BIT) { - +bool TSTBIT(long mask, int bit) { /* Returns true if the specified bit is set in the mask. */ - - return(MOD(MASK/SETBIT(BIT),2) != 0); + return((mask & (1 << bit)) != 0); } void set_seed(long seedval)