$Bitpacking: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: $Bitpacking
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Back to [[local compiler directives]]. | |
| 2 | + | ||
| 3 | + | The local compiler directive **\$BITPACKING**: | |
| 4 | + | ||
| 5 | + | - is used to compress records; | |
| 6 | + | - knows the switches ON and OFF; | |
| 7 | + | - tells the compiler whether it should use bitpacking or not when it encounters the [[Packed]] keyword for a structured type. | |
| 8 | + | ||
| 9 | + | Example: | |
| 10 | + | ||
| 11 | + | ``` pascal | |
| 12 | + | ... | |
| 13 | + | {$BITPACKING ON} | |
| 14 | + | ... | |
| 15 | + | Type | |
| 16 | + | TMyRecord = packed record | |
| 17 | + | B1, B2, B3, B4 : Boolean; | |
| 18 | + | end; | |
| 19 | + | ``` | |
| 20 | + | ||
| 21 | + | > **Note:** 1. The local compiler directive **\$BITPACKING** is ignored in MacPas compiler mode. In the MacPas compiler mode, all packed records are aligned to bit addresses.\ | |
| 22 | + | > 2\. The reserved word [[Bitpacked]] can force alignment to bit addresses, regardless of the \$BITPACKING directive and regardless of the \$MODE. | |
| 23 | + | ||
| 24 | + | ## See also | |
| 25 | + | ||
| 26 | + | - [[Bit manipulation]] | |
| 27 | + | ||
| 28 | + | --- | |
| 29 | + | *From the Free Pascal wiki, page "$Bitpacking", as it stood on 2020-02-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
