Dec 182017
Pack Boolean responses into a single bit. Save disk space. | |||
---|---|---|---|
File Name | File Size | Zip Size | Zip Type |
BITMAP4.DOC | 1477 | 749 | deflated |
BITMAP4.PAS | 4108 | 1443 | deflated |
Download File BITMAP4.ZIP Here
Contents of the BITMAP4.DOC file
BitMap4.Doc
1986
Original work by Steve Fox.
1987
Bit_Map2 modIfications by W. Mabee, CRNA And H. Kaemerrer.
1988
Bit_Map4 Modified For Turbo4.0 By W. Mabee, CRNA.
Added code to ease manipulation of data required.
Discussion :
Many applications require the storeage of a large number of
boolean reaponses. If these responses are part of a record
and a large number of these records are saved to disk. A
sizeable amount of disk storeage space can be save by saving
each of these values as a single bit.
Consider the storeage of 32 boolean answers, if stored as an
Array [1..32] Of Boolean, 32 bytes are required. However, if
stored as bits using the technique described in BitMap4 the
space required is decreased to 4 bytes (2 Integers).
In a program where a large number of records are saved to
disk the savings can be considerable. For Example consider
1000 records.
Store as an Array[1..32] Of Boolean = 32000 Bytes
Stored as an Array[1..2] Of Integer = 4000 Bytes
(* Note Each Integer Occupies 2 Bytes or 16 Bits *)
Obviously the more records stored the greater the savings.
However, if you are trying to block a records length in
64 byte blocks and you need to save space this technique
can also be helpful.
Would like to use a similar technique to store 32 bits in
a LongInt (4 Bytes : 32 Bits) but can't seem to figure out
the logic to handle this. If you can, please share it with
all of us.
Regards;
Bill Mabee
1986
Original work by Steve Fox.
1987
Bit_Map2 modIfications by W. Mabee, CRNA And H. Kaemerrer.
1988
Bit_Map4 Modified For Turbo4.0 By W. Mabee, CRNA.
Added code to ease manipulation of data required.
Discussion :
Many applications require the storeage of a large number of
boolean reaponses. If these responses are part of a record
and a large number of these records are saved to disk. A
sizeable amount of disk storeage space can be save by saving
each of these values as a single bit.
Consider the storeage of 32 boolean answers, if stored as an
Array [1..32] Of Boolean, 32 bytes are required. However, if
stored as bits using the technique described in BitMap4 the
space required is decreased to 4 bytes (2 Integers).
In a program where a large number of records are saved to
disk the savings can be considerable. For Example consider
1000 records.
Store as an Array[1..32] Of Boolean = 32000 Bytes
Stored as an Array[1..2] Of Integer = 4000 Bytes
(* Note Each Integer Occupies 2 Bytes or 16 Bits *)
Obviously the more records stored the greater the savings.
However, if you are trying to block a records length in
64 byte blocks and you need to save space this technique
can also be helpful.
Would like to use a similar technique to store 32 bits in
a LongInt (4 Bytes : 32 Bits) but can't seem to figure out
the logic to handle this. If you can, please share it with
all of us.
Regards;
Bill Mabee
December 18, 2017
Add comments