You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Characteristics struct {
Hi uint64
Lo uint64
}
And, as per the code, it encodes and decodes as little-endian.
If Go had a uint128 type, I'd definitely agree with this approach. For better or worse it doesn't, so using encoding/binary.LittleEndian doesn't save us complexity - we still have to choose between Hi and Lo.
I think it would be easier to use [16]byte, as proposed by @rvagg here: #239 (comment)
Then the logic should also become fairly straightforward to follow. For example, a "get bit" or "set bit" method on Characteristics would use pos/8 to select an array index, and pos%8 to select the bit within its byte.
The text was updated successfully, but these errors were encountered:
Right now, characteristics is as follows:
And, as per the code, it encodes and decodes as little-endian.
If Go had a uint128 type, I'd definitely agree with this approach. For better or worse it doesn't, so using
encoding/binary.LittleEndian
doesn't save us complexity - we still have to choose between Hi and Lo.I think it would be easier to use
[16]byte
, as proposed by @rvagg here: #239 (comment)Then the logic should also become fairly straightforward to follow. For example, a "get bit" or "set bit" method on Characteristics would use
pos/8
to select an array index, andpos%8
to select the bit within its byte.The text was updated successfully, but these errors were encountered: