home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_11
/
allison
/
edits.c
< prev
next >
Wrap
Text File
|
1993-09-01
|
963b
|
34 lines
LISTING 10 - Edits to Transform bits.c into bitstr.c
1) Change the string "bits" to "bitstr" everywhere (preserving
case).
2) Change line 15 from
#define offset(b) (b % BLKSIZ)
to
#define offset(b) (BLKSIZ - (b % BLKSIZ) - 1)
3) Add the macro definition
#define word(b) (b / BLKSIZ)
4) Remove the function static size_t word_(...).
5) In function static void cleanup_(...), change the line
bp->bits_[0] &= bp->clean_mask_;
to
bp->bits_[bp->nblks_ - 1] &= bp->clean_mask_;
6) Change the right shift operator in the second to last line
of function bitstr_create to a left shift.
7) In function bitstr_put, change the line
fprintf(f,"%d",bitstr_test(bp,bp->nbits_-1-i));
to
fprintf(f,"%d",bitstr_test(bp,i));
8) In function bitstr_get, change the line
if (buf[slen-1-i] == '1')
to
if (buf[i] == '1')