Archos,
Since WinTel is little-endian, uint32 is probably YX, not XY.
package main
import "fmt"
type COORD uint32
type Coord struct {
X, Y int16
}
func CoordToCOORD(coord Coord) COORD {
return COORD(uint16(coord.Y))<<16 | COORD(uint16(coord.X))
}
func COORDToCoord(coord COORD) Coord {
return Coord{int16(coord), int16(coord >> 16)}
}
func main() {
fmt.Println(COORDToCoord(CoordToCOORD(Coord{42, 7})))
}
Output:
{42 7}
http://play.golang.org/p/ahmYPC06bw
Run a test on Windows to see which one is right.
Peter
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
>
https://groups.google.com/d/topic/golang-nuts/xedBAo1V6ws/unsubscribe?hl=en-US.
> To unsubscribe from this group and all its topics, send an email to
>
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>
>