-
-
Notifications
You must be signed in to change notification settings - Fork 51
Description
I found an strange error when working with an array of structs.
Pack and unpack work correct as far as i can see with one issue ... it ignores the Endian setting (little).
For example unpack a byte stream that contains little endian floats ...
type LEData struct {
X float32 struc:"float32,little" // world co-ordinates of vehicle
Y float32 struc:"float32,little" // world co-ordinates of vehicle
Z float32 struc:"float32,little" // world co-ordinates of vehicle
}
unpackedData := &LEData{}
err = struc.Unpack(buf2, unpackedData)
Data is correct ... However ...
The data is actually an array of these items...
unpackedData := &[2]LEData{}
err = struc.Unpack(buf2, unpackedData)
The unpack "works" no errors at least :-) ..... but the data has been interpreted as Big Endian even though the data is tagged as Little.
Let me know if you need a working test case....