write struct as raw data to file

Paul phshaffer at gmail.com
Mon Sep 27 13:45:19 UTC 2021


Vitaliy,

Thanks for your assistance.  I was looking at your serialization 
package.  Is your example correct?

struct MyStruct {
         ubyte mybyte1;
         @NoCereal uint nocereal1; //won't be serialised
         @Bits!4 ubyte nibble;
         @Bits!1 ubyte bit;
         @Bits!3 ubyte bits3;
         ubyte mybyte2; }

assert(MyStruct(3, 123, 14, 1, 42).cerealise == [ 3, 0xea /*1110 
1 010*/, 42]);

        mybyte1   =   3 ?
        nocereal1 = 123 ?
        nibble    =  14 ?
        bit       =   1 ?
    ??? bits3     = ___ ???
        mybyte2   =  42 ?


More information about the Digitalmars-d-learn mailing list