Dec 072017
 
Large collection of Bit manipulation functions in Microsoft C.
File BITSTRG.ZIP from The Programmer’s Corner in
Category C Source Code
Large collection of Bit manipulation functions in Microsoft C.
File Name File Size Zip Size Zip Type
BITSTRG.C 3983 1168 deflated
CLBITARR.C 482 301 deflated
CLEARBIT.C 458 289 deflated
CPBIT.MK 778 234 deflated
CPLBIT.MK 882 290 deflated
CREBITAR.C 788 412 deflated
DECARBIT.C 718 385 deflated
FREEBITA.C 300 189 deflated
INVERTBI.C 479 295 deflated
LBITSTRG.C 4029 1170 deflated
LCLBITAR.C 623 376 deflated
LCLEARBI.C 602 373 deflated
LCREBITA.C 936 484 deflated
LDECARBI.C 861 457 deflated
LFREEBIT.C 446 277 deflated
LINVERTB.C 619 382 deflated
LSETBIT.C 593 370 deflated
LTESTBIT.C 551 341 deflated
READ.ME 4714 798 deflated
SBITSTRG.LIB 6761 1690 deflated
SBITSTRG.PUB 1857 422 deflated
SETBIT.C 450 283 deflated
TESTBIT.C 408 255 deflated

Download File BITSTRG.ZIP Here

Contents of the READ.ME file



june 05, 1989
Bit manipulation in C
(bitstrg)


The archivees are :

- sbitstrg.lib library of the bit manipulation functions
- sbitstrg.pub references to this library

- bitstrg.h The include file

- bitstrg.c The source file to test the bit
manipulation functions (1 to 65536 bits)
- lbitstrg.c The source file to test the bit
manipulation functions (1 to xxxxxx bits)

- *.c The source files of all the functions
(1 to 65536 bits)
- l*.c The source files of all the functions
(1 to xxxxxx bits)

- cpbit.mk The make file to generate the executable
test for 1 to 65536 bits
- cplbit.mk The make file to generate the executable
test for 1 to xxxxxx bits


Compiler used : Microsoft C 5.1. Should be easily portable.



The functions in the library are :

/*
Creation of an array of bit

The array is initialized to all 0s
return a pointer on the array parameters structure or NULL if problem
*/

struct SPARRAY* crebitarray(nbbit)
unsigned nbbit; /* number of the last bit in the array */


/*
Clear bit array to all 0s
*/

void clrbitarray(ptr)
struct SPARRAY * ptr; /* pointer on structure */

/*
declaration of a memory field as an array of bit

return a pointer on the array parameters structure or NULL if problem
*/

struct SPARRAY* decarbit(ptr,nombr)
ELEBAR* ptr; /* pointer on the memory field */
unsigned nombr; /* number of elements in the field */

/*
invert state of specified bit

if bit > map size, 0 is returned, else 1 is returned
*/

unsigned invertbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */

/*
Set specified bit

if bit > map size, 0 is returned, else 1 is returned
*/

unsigned setbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */


/*
Clear specified bit
*/

unsigned clearbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */


/*
Test specified bit

return non zero if set, else return zero
*/

unsigned testbit(ptr,bit)
struct SPARRAY * ptr; /* pointer on structure */
unsigned bit; /* bit number */


/*
Restitution of the memory space of an array of bit
*/

void freebitarray(ptr)
struct SPARRAY * ptr; /* pointer on structure */


/*
Creation of an array of bit

The array is initialized to all 0s
return a pointer on the array parameters structure or NULL if problem
*/

struct LSPARRAY* lcrebitarray(nbbit)
unsigned long nbbit; /* number of the last bit in the array */


/*
Clear bit array to all 0s
*/

void lclrbitarray(ptr)
struct LSPARRAY * ptr; /* pointer on structure */

/*
declaration of a memory field as an array of bit

return a pointer on the array parameters structure or NULL if problem
*/

struct LSPARRAY* ldecarbit(ptr,nombr)
ELEBAR* ptr; /* pointer on the memory field */
unsigned nombr; /* number of elements in the field */

/*
invert state of specified bit

if bit > map size, 0 is returned, else 1 is returned
*/

unsigned linvertbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */


/*
Set specified bit

if bit > map size, 0 is returned, else 1 is returned
*/

unsigned lsetbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */


/*
Clear specified bit
*/

unsigned lclearbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */


/*
Test specified bit

return non zero if set, else return zero
*/

unsigned ltestbit(ptr,bit)
struct LSPARRAY * ptr; /* pointer on structure */
unsigned long bit; /* bit number */


/*
Restitution of the memory space of an array of bit
*/

void lfreebitarray(ptr)
struct LSPARRAY * ptr; /* pointer on structure */


 December 7, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)