HaxeFoundation / HaxeFoundation/haxe

Lack of implementations in Bytes, BytesInput, BytesOutput

Open
#9,855 0 comments 7 reactions 0 assignees View on GitHub
help wanted
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hi!
Looks like a `Bytes`, `BytesInput`, and `BytesOutput` classes are missing some important implementations.

For example, Bytes class has:
| read | write |
| ------------- | ------------- |
| get (same as uint8) | set (same as uint8) |
| getUInt16 | setUInt16 |
| getInt32 | setInt32 |
| getInt64 | setInt64 |
| getFloat | setFloat |
| getDouble | setDouble |

Missing: getInt16, setInt16, getInt8, setInt8
Also, would be nice to have separate methods for getUInt8 and setUInt8, instead of using get/set.
No way to change bytes order (probably it is by design, but...)

Also:
| BytesInput | BytesOutput|
| ------------- | ------------- |
| read (same as uint8) | write (same as uint8) |
| readInt8 | writeInt8 |
| readInt16 | writeInt16 |
| readInt24 | writeInt24 |
| readInt32 | writeInt32 |
| readUInt16 | writeUInt16 |
| readUInt24 | writeUInt24 |

Missing: read/write UInt32, read/write Int64, read/write UInt64, read/write Float, read/write Double.

So, there is no consistency and cross-platform way to work with all kinds of binary data from out of the box right now.
Would be nice to have something like what JavaScript (and other languages) have, for example `js.DateView` class:
| read| write |
| ------------- | ------------- |
| getUint8 | setUint8 |
| getUint16 | setUint16 |
| getUint32 | setUint32 |
| getInt8 | setInt8 |
| getInt16 | setInt16 |
| getInt32 | setInt32 |
| getFloat32 | setFloat32 |
| getFloat64 | setFloat64|

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.