BZ_rand_init() - Turn BZ_RAND_INIT_MASK into a function

parent 7bd2dc3c
......@@ -135,9 +135,7 @@ typedef struct {
Int32 rTPos;
} RandState;
#define BZ_RAND_INIT_MASK \
s->rand.rNToGo = 0; \
s->rand.rTPos = 0 \
extern RandState BZ2_rand_init(void);
#define BZ_RAND_MASK ((s->rand.rNToGo == 1) ? 1 : 0)
......
......@@ -547,7 +547,7 @@ Int32 BZ2_decompress ( DState* s )
s->tPos = s->origPtr;
s->nblock_used = 0;
if (s->blockRandomised) {
BZ_RAND_INIT_MASK;
s->rand = BZ2_rand_init();
BZ_GET_SMALL(s->k0); s->nblock_used++;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
} else {
......@@ -566,7 +566,7 @@ Int32 BZ2_decompress ( DState* s )
s->tPos = s->tt[s->origPtr] >> 8;
s->nblock_used = 0;
if (s->blockRandomised) {
BZ_RAND_INIT_MASK;
s->rand = BZ2_rand_init();
BZ_GET_FAST(s->k0); s->nblock_used++;
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
} else {
......
......@@ -78,6 +78,16 @@ Int32 BZ2_rNums[512] = {
936, 638
};
RandState
BZ2_rand_init(void)
{
RandState r;
r.rNToGo = 0;
r.rTPos = 0;
return r;
}
/*-------------------------------------------------------------*/
/*--- end randtable.c ---*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment