Dekkonot / bitbuffer

A binary stream module for packing binary data in pure Lua
https://dekkonot.github.io/bitbuffer/
MIT License
44 stars 11 forks source link

Add several common datatypes to module as shorthands #4

Closed Dekkonot closed 4 years ago

Dekkonot commented 4 years ago

Should include things like Int32 and UInt32. Should also shorthand some like writeByte -> writeUInt8.

Unclear how to handle assertions and testing. Seems like it may add a lot of overhead to run assertions twice in cases like writeFloat32.

Dekkonot commented 4 years ago

Upon further reflection, all those datatypes can use custom implementations anyway, so it's possible no design choices are needed (all of them are even bytes so writeByte can be used for all of them. That's at most 8 calls.)

Running the assertions multiple times is still a concern though; it might be an acceptable loss though, given they'll all just be using writeByte.

Dekkonot commented 4 years ago

UInt64 and Int64 are rejected at this moment -- the name is deceiving and creates the illusion of 64-bit integers. If 64-bit read/write functions are necessary, they can be added manually.