HeapsIO / hxbit

Haxe Binary serialization and network synchronization library
155 stars 30 forks source link

16/8 bit support? #27

Closed Glidias closed 6 years ago

Glidias commented 6 years ago

Any reason why there's no getInt16 / setInt16 for Serializer? There's getByte()/readByte(), etc. though (and i noticed the checks do check for values of of v >= 0 && v < 128 , kinda weird to read write bytes? Why didn't they go for v>=0 && v < 256?). It seems that approach for Serializer resorts to a universal lookup table of ints/bytes as a general approach? How do i go about reading shorts 16s?

ncannasse commented 6 years ago

ATM we don't have a proper way to declare an int/uint 8/16 in Haxe that would work on all platforms and overflow correctly. This is something we are thinking at adding later. We we do, adding it to hxbit should be feasible, but not atm as we don't want to restrict only the range when sending over network and end up with different values between client and server in case of overflow.