View Issue Details

IDProjectCategoryView StatusLast Update
0038536FPCCompilerpublic2021-04-07 14:25
ReporterKai Burghardt Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Platformx86_64OSGNU/Linux 
Product Version3.2.0 
Summary0038536: feature request for _true_ bitpacked arrays
DescriptionI would appreciate if there were /true/ bitpacked data structures. It is still possible to declare data types that will leave bits unused, compare the following example:
Steps To ReproduceThe following program will report a `sizeOf` 2 Bytes.

program staticArray(input, output, stdErr);
type
    x = (left, right);
    y = (up, down);
    z = bitpacked array[x, y] of Boolean;
begin
    writeLn( sizeOf(z):2, 'B':2);
    writeLn(bitSizeOf(z):2, 'b':2);
end.

Frankly, I would have expected a `bitSizeOf` 4 (four), though.
Additional InformationUsing short notation makes no difference. This type definition produces the same:

    z = bitpacked array[x] of bitpacked array[y] of Boolean;
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Jonas Maebe

2021-02-23 19:11

manager   ~0129126

Only ordinals can be bitpacked. A two dimensional array is indeed equivalent to an array of arrays, and arrays are not ordinal types. The same holds for arrays of bitpacked records, or array fields in bipacked records. This is compatible with all ABIs I know of, and there are no plans to change this.

Issue History

Date Modified Username Field Change
2021-02-23 18:34 Kai Burghardt New Issue
2021-02-23 19:11 Jonas Maebe Assigned To => Jonas Maebe
2021-02-23 19:11 Jonas Maebe Status new => resolved
2021-02-23 19:11 Jonas Maebe Resolution open => won't fix
2021-02-23 19:11 Jonas Maebe FPCTarget => -
2021-02-23 19:11 Jonas Maebe Note Added: 0129126