亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fixedmath.h

?? MiniGUI for uCOS 移植實驗全部源碼
?? H
?? 第 1 頁 / 共 2 頁
字號:
/**
 * \file fixedmath.h
 * \author Wei Yongming <ymwei@minigui.org>
 * \date 2002/01/12
 * 
 *  This file includes fixed point and three-dimension math routines.
 *
 \verbatim
    Copyright (C) 1998-2002 Wei Yongming.
    Copyright (C) 2002-2004 Feynman Software.

    This file is part of MiniGUI, a compact cross-platform Graphics 
    User Interface (GUI) support system for real-time embedded systems.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 \endverbatim
 */

/*
 * $Id: fixedmath.h,v 1.20 2004/06/26 08:41:44 weiym Exp $
 *
 *             MiniGUI for Linux/uClinux, eCos, uC/OS-II, and VxWorks version 1.6.x
 *             Copyright (C) 1998-2002 Wei Yongming.
 *             Copyright (C) 2002-2004 Feynman Software.
 *
 *             Fix point math routins come from Allegro
 *             By Shawn Hargreaves and others.
 *             So thank for their great work and good license.
 *
 *             "Allegro is a gift-software" 
 *
 *         ______   ___    ___
 *        /\  _  \ /\_ \  /\_ \
 *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
 *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
 *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
 *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
 *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
 *                                           /\____/
 *                                           \_/__/
 *
 */

#ifndef _MGUI_FIXED_MATH_H
#define _MGUI_FIXED_MATH_H

#include <errno.h>
#include <math.h>

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

#ifdef _FIXED_MATH

    /**
     * \addtogroup fns Functions
     * @{
     */

    /**
     * \addtogroup global_fns Global/general functions
     * @{
     */

    /**
     * \defgroup fixed_math_fns Fixed point math functions
     * 
     * You know that the float point mathematics routines are very
     * expensive. If you do not want precision mathematics result, 
     * you can use fixed point. MiniGUI uses a double word (32-bit)
     * integer to represent a fixed point ranged from -32767.0 to 
     * 32767.0, and defines some fixed point mathematics routines for 
     * your application. Some GDI functions need fixed point 
     * math routines, like \a Arc.
     *
     * Example 1:
     * 
     * \include fixed_point.c
     *
     * Example 2:
     * 
     * \include fixedpoint.c
     * @{
     */

/**
 * \fn fixed fsqrt (fixed x)
 * \brief Returns the non-negative square root of a fixed point value.
 *
 * This function returns the non-negative square root of \a x.
 * It fails and sets errno to EDOM, if x is negative.
 *
 * \sa fhypot
 */
fixed fsqrt (fixed x);

/**
 * \fn fixed fhypot (fixed x, fixed y)
 * \brief Returns the Euclidean distance from the origin.
 * 
 * The function returns the \a sqrt(x*x+y*y). This is the length of 
 * the hypotenuse of a right-angle triangle with sides of length \a x and \a y, 
 * or the distance of the point \a (x,y) from the origin.
 *
 * \sa fsqrt
 */
fixed fhypot (fixed x, fixed y);

/**
 * \fn fixed fatan (fixed x)
 * \brief Calculates the arc tangent of a fixed point value.
 *
 * This function calculates the arc tangent of \a x; that is the value 
 * whose tangent is \a x.
 *
 * \return Returns the arc tangent in radians and the value is 
 *         mathematically defined to be between -PI/2 and PI/2 (inclusive).
 *
 * \sa fatan2
 */
fixed fatan (fixed x);

/**
 * \fn fixed fatan2 (fixed y, fixed x)
 * \brief Calclulates the arc tangent of two fixed point variables.
 *
 *  This function calculates the arc tangent of the two variables \a x and \a y.
 *  It is similar to calculating the arc tangent of \a y / \a x, except that 
 *  the signs of both arguments are used to determine the quadrant of the result.
 *
 * \return Returns the result in radians, which is between -PI and PI (inclusive).
 *
 * \sa fatan
 */
fixed fatan2 (fixed y, fixed x);

extern fixed _cos_tbl[];
extern fixed _tan_tbl[];
extern fixed _acos_tbl[];

/************************** inline fixed point math functions *****************/
/* ftofix and fixtof are used in generic C versions of fmul and fdiv */

/**
 * \fn fixed ftofix (double x)
 * \brief Converts a float point value to a fixed point value.
 *
 * This function converts the specified float point value \a x to 
 * a fixed point value.
 *
 * \note The float point should be ranged from -32767.0 to 32767.0.
 * If it runs out of the range, this function sets \a errno to \a ERANGE.
 *
 * \sa fixtof
 */
static inline fixed ftofix (double x)
{ 
   if (x > 32767.0) {
      errno = ERANGE;
      return 0x7FFFFFFF;
   }

   if (x < -32767.0) {
      errno = ERANGE;
      return -0x7FFFFFFF;
   }

   return (long)(x * 65536.0 + (x < 0 ? -0.5 : 0.5)); 
}

/**
 * \fn double fixtof (fixed x)
 * \brief Converts a fixed point value to a float point value.
 *
 * This function converts the specified fixed point value \a x to 
 * a float point value.
 *
 * \sa ftofix
 */
static inline double fixtof (fixed x)
{ 
   return (double)x / 65536.0; 
}


/**
 * \fn fixed fadd (fixed x, fixed y)
 * \brief Returns the sum of two fixed point values.
 *
 * This function adds two fixed point values \a x and \a y, and
 * returns the sum.
 *
 * \param x x,y: Two addends.
 * \param y x,y: Two addends.
 * \return The sum. If the result runs out of range of fixed point, this function
 *         sets \a errno to \a ERANGE.
 *
 * \sa fsub
 */
static inline fixed fadd (fixed x, fixed y)
{
   fixed result = x + y;

   if (result >= 0) {
      if ((x < 0) && (y < 0)) {
	 errno = ERANGE;
	 return -0x7FFFFFFF;
      }
      else
	 return result;
   }
   else {
      if ((x > 0) && (y > 0)) {
	 errno = ERANGE;
	 return 0x7FFFFFFF;
      }
      else
	 return result;
   }
}

/**
 * \fn fixed fsub (fixed x, fixed y)
 * \brief Subtract a fixed point value from another.
 *
 * This function subtracts the fixed point values \a y from the fixed point value \a x,
 * and returns the difference.
 *
 * \param x The minuend.
 * \param y The subtrahend.
 * \return The difference. If the result runs out of range of fixed point, this function
 *         sets \a errno to \a ERANGE.
 *
 * \sa fadd
 */
static inline fixed fsub (fixed x, fixed y)
{
   fixed result = x - y;

   if (result >= 0) {
      if ((x < 0) && (y > 0)) {
	 errno = ERANGE;
	 return -0x7FFFFFFF;
      }
      else
	 return result;
   }
   else {
      if ((x > 0) && (y < 0)) {
	 errno = ERANGE;
	 return 0x7FFFFFFF;
      }
      else
	 return result;
   }
}

/**
 * \fn fixed fmul (fixed x, fixed y)
 * \brief Returns the product of two fixed point values.
 * 
 * This function returns the product of two fixed point values \a x and \a y.
 *
 * \param x The faciend.
 * \param y The multiplicato.
 * \return The prodcut. If the result runs out of range of fixed point, this function
 *         sets \a errno to \a ERANGE.
 * 
 * \sa fdiv
 */
static inline fixed fmul (fixed x, fixed y)
{
   return ftofix(fixtof(x) * fixtof(y));
}

/**
 * \fn fixed fdiv (fixed x, fixed y)
 * \brief Returns the quotient of two fixed point values.
 * 
 * This function returns the quotient of two fixed point values \a x and \a y.
 *
 * \param x The dividend.
 * \param y The divisor.
 * \return The quotient. If the result runs out of range of fixed point, this function
 *         sets \a errno to \a ERANGE.
 * 
 * \sa fmul
 */
static inline fixed fdiv (fixed x, fixed y)
{
   if (y == 0) {
      errno = ERANGE;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级片在线看| 91视频一区二区三区| 国产欧美一区在线| 色av综合在线| 狠狠网亚洲精品| 亚洲另类一区二区| 欧美一级二级在线观看| 色94色欧美sute亚洲线路二| 国产一区二区三区四区五区入口 | 精品久久久久久综合日本欧美| 国产精品一区二区男女羞羞无遮挡 | 日本一区二区视频在线观看| 91久久精品国产91性色tv| 裸体歌舞表演一区二区| 亚洲乱码精品一二三四区日韩在线| 精品欧美乱码久久久久久| 欧美丝袜丝nylons| 91网上在线视频| 风间由美性色一区二区三区| 捆绑变态av一区二区三区| 亚洲国产成人精品视频| 国产精品动漫网站| 日本一区二区三级电影在线观看| 日韩亚洲欧美在线观看| 欧美美女喷水视频| 欧美性欧美巨大黑白大战| 99re热视频精品| 粉嫩av亚洲一区二区图片| 久久99国产精品成人| 日本亚洲视频在线| 日韩vs国产vs欧美| 日日夜夜精品免费视频| 偷窥少妇高潮呻吟av久久免费| 国产欧美一区二区精品性色 | 国产精品一区二区果冻传媒| 午夜精品一区二区三区电影天堂| 中文字幕日本不卡| 中文字幕亚洲欧美在线不卡| 久久久久国产精品麻豆ai换脸| 欧美精品一区二区久久婷婷| 日韩一二在线观看| 91麻豆精品91久久久久同性| 欧美三级中文字| 欧美视频精品在线观看| 欧美性欧美巨大黑白大战| 欧美性猛片xxxx免费看久爱 | 国产精品家庭影院| 国产精品每日更新| 亚洲欧美日韩一区| 国产精品二三区| 中文字幕在线观看一区| 亚洲欧洲美洲综合色网| **网站欧美大片在线观看| 日韩理论片在线| 亚洲精品一二三| 午夜国产精品一区| 日韩va欧美va亚洲va久久| 亚洲123区在线观看| 亚洲一区二区三区四区中文字幕| 亚洲一区在线免费观看| 亚洲成av人片观看| 久久精品免费观看| 国产成人午夜电影网| 99久久99久久精品免费观看| 在线免费不卡电影| 日韩美女视频一区二区在线观看| 久久久久久久综合| 亚洲免费观看高清完整版在线观看熊 | 日韩三级电影网址| 久久精品夜色噜噜亚洲a∨| 国产精品黄色在线观看 | 国产69精品久久99不卡| 色94色欧美sute亚洲13| 91精品国产品国语在线不卡| 久久久国产午夜精品| 亚洲欧美色一区| 久久国产精品99久久久久久老狼| 丰满放荡岳乱妇91ww| 欧美日韩一级片网站| 欧美精品一区二区三区蜜桃视频 | 欧美日韩国产综合久久| 精品日韩在线观看| 国产精品卡一卡二| 五月激情综合色| 国产精品一区二区果冻传媒| 在线亚洲高清视频| 欧美一区二区三区视频免费| 久久久久99精品一区| 亚洲一区二区在线免费观看视频| 狠狠色丁香九九婷婷综合五月| jlzzjlzz欧美大全| 欧美一二区视频| 亚洲精品国产视频| 国产一区二区调教| 欧美男男青年gay1069videost| 精品欧美久久久| 亚洲精选一二三| 国产精品一卡二| 欧美色图片你懂的| 国产欧美日韩精品在线| 婷婷久久综合九色国产成人| 99在线精品免费| 精品成人私密视频| 五月天一区二区三区| 91老司机福利 在线| 欧美精品一区二区三区久久久| 亚洲日本青草视频在线怡红院| 日本免费新一区视频| 91在线视频观看| 亚洲精品一区二区三区在线观看 | 欧美日韩免费电影| 1000部国产精品成人观看| 国产精品一区二区视频| 欧美日韩国产小视频在线观看| 国产精品国产三级国产aⅴ入口 | 91在线视频网址| 中文字幕不卡一区| 免费美女久久99| 欧美日韩免费一区二区三区视频 | 日韩毛片在线免费观看| 国产精品69毛片高清亚洲| 欧美无乱码久久久免费午夜一区 | 免费成人你懂的| 欧美日韩国产综合久久| 亚洲啪啪综合av一区二区三区| 国产成人综合精品三级| 精品国产乱码久久久久久老虎| 亚洲va国产va欧美va观看| 欧美综合在线视频| 亚洲人妖av一区二区| 成人深夜视频在线观看| 欧美xingq一区二区| 视频精品一区二区| 91精品久久久久久久99蜜桃| 亚洲国产另类精品专区| 色菇凉天天综合网| 亚洲精品免费播放| 欧美性生活久久| 午夜国产不卡在线观看视频| 欧美一区二区三区不卡| 日产欧产美韩系列久久99| 欧美日韩黄色一区二区| 亚洲成人动漫在线观看| 99精品欧美一区二区蜜桃免费 | 成人免费看黄yyy456| 久久久久国产精品麻豆| 高清视频一区二区| 国产日韩欧美制服另类| 精品亚洲国产成人av制服丝袜| 欧美videofree性高清杂交| 蜜桃av一区二区三区电影| 精品少妇一区二区三区在线播放| 国产精品亚洲成人| 亚洲欧美自拍偷拍| 欧洲一区在线观看| 奇米777欧美一区二区| xnxx国产精品| av网站免费线看精品| 亚洲午夜免费视频| 日韩午夜激情电影| 国产91丝袜在线18| 一区二区三区自拍| 欧美一区二区三区免费观看视频| 国产一区二区三区四区在线观看 | 一区二区三区在线观看欧美| 欧美系列亚洲系列| 捆绑调教一区二区三区| 中文字幕乱码日本亚洲一区二区| 色婷婷国产精品久久包臀| 亚洲国产视频一区| 日韩你懂的在线观看| 成人免费观看av| 亚洲6080在线| 亚洲国产精品激情在线观看| 欧美系列一区二区| 国产精品一二二区| 亚洲永久免费av| 日韩美女视频一区二区在线观看| 大陆成人av片| 亚洲h精品动漫在线观看| 久久夜色精品一区| 91国偷自产一区二区开放时间| 免费成人美女在线观看| 中文字幕日韩av资源站| 日韩久久久精品| 在线亚洲人成电影网站色www| 久久99精品国产麻豆婷婷| 欧美国产日韩精品免费观看| 欧洲视频一区二区| 国产精品综合网| 天天影视网天天综合色在线播放| 欧美极品美女视频| 9191成人精品久久| 一本一道综合狠狠老| 国产尤物一区二区在线 | 91亚洲国产成人精品一区二三| 日韩av一二三| 国产精品国产馆在线真实露脸| 3d成人h动漫网站入口| 91在线一区二区|