jefffhaynes / BinarySerializer

A declarative serialization framework for controlling formatting of data at the byte and bit level using field bindings, converters, and code.
MIT License
290 stars 62 forks source link

Added FieldBitOrder attribute with BitOrder enumeration. #207

Closed bevanweiss closed 1 year ago

bevanweiss commented 1 year ago

Currently these are labelled LsbFirst (0) and MsbFirst (1). If no BitOrder attribute is applied, behaviour is as per LsbFirst, which aligns with the existing behaviour (all current tests pass).

Currently there is no exception thrown for if a byte is used by both an LsbFirst and an MsbFirst field (which I believe should be unsupported operation). I did attempt to add this, but I couldn't get it working right (it appeared there were LSB writes occuring even though I only had MSB fields defined). I think these exceptions could be introduced later if necessary (perhaps both MSB and LSB access is a use case for someone).

Fixes #205

jefffhaynes commented 1 year ago

Impressive PR, thanks!