00001 /* 00002 * $Id: openwince.h,v 1.1 2005/09/29 08:31:18 telka Exp $ 00003 * 00004 * Common header file 00005 * Copyright (C) 2002 ETC s.r.o. 00006 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 3. Neither the name of the ETC s.r.o. nor the names of its contributors 00017 * may be used to endorse or promote products derived from this software 00018 * without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 00024 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00025 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00026 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00027 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00028 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00029 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 * Written by Marcel Telka <marcel@telka.sk>, 2002. 00032 * 00033 */ 00034 00035 #ifndef COMMON_H 00036 #define COMMON_H 00037 00038 #ifndef LANGUAGE 00039 # ifdef __ASSEMBLY__ 00040 # define LANGUAGE ASM 00041 # else 00042 # define LANGUAGE C 00043 # endif 00044 #endif 00045 00046 #ifndef ASM 00047 #define ASM 0 00048 #endif 00049 00050 #ifndef C 00051 #define C 1 00052 #endif 00053 00054 #define MAX_BITS_ABS_VAL 1024 00055 #define BITS_ABS(a) (((((a) + MAX_BITS_ABS_VAL) / MAX_BITS_ABS_VAL) * 2 - 1) * (a)) 00056 #define BITS_MIN(a,b) (((a) + (b) - BITS_ABS((a) - (b))) / 2) 00057 00058 #define bit(b) (1 << (b)) 00059 #define bits(b1,b2) (((2 << BITS_ABS((b1) - (b2))) - 1) << BITS_MIN(b1,b2)) 00060 #define bits_val(b1,b2,v) (((v) << BITS_MIN(b1,b2)) & bits(b1,b2)) 00061 #define bits_get(b1,b2,v) (((v) & bits(b1,b2)) >> BITS_MIN(b1,b2)) 00062 00063 #endif /* COMMON_H */
1.4.7