105b261ecSmrg/*
205b261ecSmrg * Copyright (C) 2000 The XFree86 Project, Inc.  All Rights Reserved.
305b261ecSmrg *
405b261ecSmrg * Permission is hereby granted, free of charge, to any person obtaining a copy
505b261ecSmrg * of this software and associated documentation files (the "Software"), to
605b261ecSmrg * deal in the Software without restriction, including without limitation the
705b261ecSmrg * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
805b261ecSmrg * sell copies of the Software, and to permit persons to whom the Software is
905b261ecSmrg * furnished to do so, subject to the following conditions:
1005b261ecSmrg *
1105b261ecSmrg * The above copyright notice and this permission notice shall be included in
1205b261ecSmrg * all copies or substantial portions of the Software.
1305b261ecSmrg *
1405b261ecSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505b261ecSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605b261ecSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1705b261ecSmrg * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1805b261ecSmrg * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905b261ecSmrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2005b261ecSmrg *
2105b261ecSmrg * Except as contained in this notice, the name of the XFree86 Project shall
2205b261ecSmrg * not be used in advertising or otherwise to promote the sale, use or other
2305b261ecSmrg * dealings in this Software without prior written authorization from the
2405b261ecSmrg * XFree86 Project.
2505b261ecSmrg *
2605b261ecSmrg */
2705b261ecSmrg
2805b261ecSmrg#ifndef _MICOORD_H_
2905b261ecSmrg#define _MICOORD_H_ 1
3005b261ecSmrg
3105b261ecSmrg#include "servermd.h"
3205b261ecSmrg
3305b261ecSmrg/* Macros which handle a coordinate in a single register */
3405b261ecSmrg
3505b261ecSmrg#define GetHighWord(x) (((int) (x)) >> 16)
3605b261ecSmrg
3705b261ecSmrg#if IMAGE_BYTE_ORDER == MSBFirst
3805b261ecSmrg#define intToCoord(i,x,y)   (((x) = GetHighWord(i)), ((y) = (int) ((short) (i))))
3905b261ecSmrg#define coordToInt(x,y)	(((x) << 16) | ((y) & 0xffff))
4005b261ecSmrg#define intToX(i)	(GetHighWord(i))
4105b261ecSmrg#define intToY(i)	((int) ((short) i))
4205b261ecSmrg#else
4305b261ecSmrg#define intToCoord(i,x,y)   (((x) = (int) ((short) (i))), ((y) = GetHighWord(i)))
4405b261ecSmrg#define coordToInt(x,y)	(((y) << 16) | ((x) & 0xffff))
4505b261ecSmrg#define intToX(i)	((int) ((short) (i)))
4605b261ecSmrg#define intToY(i)	(GetHighWord(i))
4705b261ecSmrg#endif
4805b261ecSmrg
4935c4bbdfSmrg#endif                          /* _MICOORD_H_ */
50