mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-15 02:08:56 +00:00
Update API to represent coords as []uint64
This commit is contained in:
@ -115,6 +115,29 @@ func wire_decode_coords(packet []byte) ([]byte, int) {
|
||||
return packet[coordBegin:coordEnd], coordEnd
|
||||
}
|
||||
|
||||
// Converts a []uint64 set of coords to a []byte set of coords.
|
||||
func wire_coordsUint64stoBytes(in []uint64) (out []byte) {
|
||||
for _, coord := range in {
|
||||
c := wire_encode_uint64(coord)
|
||||
out = append(out, c...)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Converts a []byte set of coords to a []uint64 set of coords.
|
||||
func wire_coordsBytestoUint64s(in []byte) (out []uint64) {
|
||||
offset := 0
|
||||
for {
|
||||
coord, length := wire_decode_uint64(in[offset:])
|
||||
if length == 0 {
|
||||
break
|
||||
}
|
||||
out = append(out, coord)
|
||||
offset += length
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Encodes a swtichMsg into its wire format.
|
||||
|
Reference in New Issue
Block a user