Skip to content

Bug in Struct.GetStructSize() ? #235

@Equino3108

Description

@Equino3108

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions