Skip to content

[swift] support for unaligned buffers #7640

@mr-swifter

Description

@mr-swifter

Usually when reading data from network or from binary file there is no guarantee that data will be placed in memory with respect to alignment. So, trying to use such memory buffers as is will lead to precondition.

In swift 5.7 there is a new loadUnaligned function is available, so plain data types can be accessed without respect to alignment. So, seems that means by using loadUnaligned we can create flatbuffer from any buffer and it will work normally.

So, I suggest to start using loadUnaligned instead of load. storeBytes works without changing function signature. Do i miss anything?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions