shimmeringbee / bytecodec

Implementation of a byte codec to Marshal/Unmarshal structs to []byte, compatible with Zigbee types, written in Go.

Home Page:https://shimmeringbee.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not support signed integers

pwood opened this issue · comments

Bytecodec needs to support marshalling signed integers, this is currently done in shimmeringbee/zcl so some knowledge can be transfered.

Correction, the code that's has support for signed ints is the bitbuffer in bytecodec.

https://github.com/shimmeringbee/bytecodec/blob/master/bitbuffer/int.go#L17

This might just be a case of adding catches for the reflection types in marshalValue/unmarshalValue, and calling the right bitbuffer function.

Needs tests, and beer after dealing with 2's complement negative numbers in tests.