-
Notifications
You must be signed in to change notification settings - Fork 646
Open
Labels
Description
I got a struct with size 16 Bytes and at the end, I also define 4 bool(bit) fields, which brings size up to 16.5 as GetStructSize adds 0.125 per bool field it finds.
At the end of GetStructSize, you return (int)numbytes which cuts off the .5 and makes the method return a size of 16. After that it crashes at some point in Struct.ToBytes() - apparently because it tries to write bit values to byte 17 which isn't present i the bytes[] array.
I believe GetStructSize() should return (int)Math.Ceiling(numBytes) instead.