Hi all
A couple of months ago, I someone could tell me whether it was possible to have record variants of sets lesser than 32 members to be aligned. Frank Heckenbach told me to make GPC use 8 bits as the smallest size for a set, by changing TSelElement in p/rts/sets.pas and set_word_size and set_alignment in p/util.c. That worked great, had it not been for the fact that the code depended on reversed ordering of those bytes! (Actually, what I need is the elements in the set to represent the binary bits in a consecutive order)
In the following code, I need BIT0 to be represented by the most significant bit of USRINT, and BIT15 by the least significant.
*********************************** TYPE INT16 = INTEGER(16); INT8 = packed -128..127; INT0_65535 = packed 0..65535; B_TYPE = (B1, B2, B3, B4, B5, B6, B7, B8); BITS = (BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, BIT7, BIT8,
BIT9, BIT10, BIT11, BIT12, BIT13, BIT14, BIT15);
B_TYPE_SET = set of B_TYPE; BIT_SET = set of BITS;
VAR OUT_REC = record case INT16 of 0 : (BSLB : B_TYPE_SET; BSHB : B_TYPE_SET); 1 : (USRINT : INT0_65535); 2 : (BT : BIT_SET); end; ************************************
I tried to change set_words_big_endian to "1", in p/util.c! That made the bit representation work, but when I tried running p/test/setest.pas, I got the following result:
"The set opcodes work : [] False mul plus minus in and rel False"
Is there a way to get sets to use "set_words_big_endian", or am I on a totally hopeless mission, all together? It would really save my day if this would be possible!
Best Regards and Merry Christmas Sven Jauring