Bit packing

Contestcen at aol.com Contestcen at aol.com
Fri Jun 15 09:27:42 CEST 2007


In a message dated 6/14/2007 1:40:34 AM Eastern Standard Time, 
florian at freepascal.org writes:

How does the pascal macro compiler solve it? It tries to solve it for
bit/booleans arrays but not for subrange types which are much harder
because of endian issues. Tries because it doesn't take care of things
like debugging.

(Continuing previous answer)  If the problem is that some Pascal compilers 
store large integers with the least-significant byte first, while others store 
the most-significant byte first, one solution would be to form the 
concatenation of bit fields into a string of integers, and let each compiler store them 
according to its own rules.
 
How complex the macros become depends on what is needed.  Do the bit fields 
need to cross boundaries of integer fields?  Are mixed-sized integers needed 
within each record?  Are you carving up a large array into bit fields whose 
lengths will be determined at runtime?
 
If the problem is that one compiler stores array elements in order x[1], 
x[2], x[3], ... which another compiler stores them x[100], x[99], ... then you 
simply let the compiler use its own array indexing scheme.
 
Frank



************************************** See what's free at http://www.aol.com.





More information about the Gpc mailing list