• about the last post

    From Chris Hoppman@1:129/305 to All on Sun Sep 26 14:39:09 2004
    Okay, I got it wrong in the last post. This is how I have it setup.

    program testset;
    uses crt;

    type
    aset = 1..24;
    bset = (rlogon, {1}
    rchat, {2}
    rvalidate,{3}
    ruserlist,{4}
    ramsg, {5}
    rpostan, {6}
    rpost, {7}
    remail, {8}
    rvoting, {9}
    rmsg, {10}
    vt100, {11}
    hotkey, {12}
    avatar, {13}
    pause, {14}
    novice, {15}
    ansi, {16}
    color, {17}
    alert, {18}
    smw, {19}
    nomail, {20}
    fnodlratio, {21}
    fnopostratio, {22}
    fnocredits, {23}
    fnodeletion); {24}
    arec = record
    aaset:set of aset;
    bbset:set of bset;
    end;
    var
    srec : arec;

    begin
    clrscr;
    {they both have 24 elements}
    writeln('Set A SizeOf: ',Sizeof(srec.aaset));{returns 4}
    Writeln('Set B SizeOf: ',Sizeof(srec.bbset));{returns 3}
    writeln;
    write('press a key');
    repeat until keypressed;
    end.
    --- Renegade v09-19.4 DOS
    * Origin: The Titantic BBS Telnet - ttb.slyip.com (1:129/305)
  • From Jasen Betts@3:640/1042 to Chris Hoppman on Tue Sep 28 09:08:07 2004
    Hello Chris.

    26 Sep 04 13:39, you wrote to all:

    Okay, I got it wrong in the last post. This is how I have it setup.



    program testset;
    uses crt;

    type
    aset = 1..24;

    try this:
    aset = 0..23;

    als try this

    aset = 7..16;

    sets of integers aren't packed they are bit-aligned on 0.
    so bits in the set that represent the elements look like this:

    07 06 05 40 03 02 01 --
    15 14 13 12 11 10 09 08
    23 22 21 20 19 18 17 16
    -- -- -- -- -- -- -- 24

    with your enumerated type
    however

    bset = (rlogon, {1}

    ord(rlogin) == 0

    fnodeletion); {24}

    ord(nodeletion) == 23

    In that way it looks like a aet of 0..23 to the part of the compiler which handles sets.

    07 06 05 40 03 02 01 00
    15 14 13 12 11 10 09 08
    23 22 21 20 19 18 17 16

    and that only takes 3 bytes



    Jasen
    --- GoldED+/LNX 1.1.4.7
    * Origin: (3:640/1042)