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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清完整版在线观看熊| 欧美日韩一区在线| 国产午夜精品一区二区三区嫩草 | 成人午夜短视频| 久久综合久色欧美综合狠狠| 天天综合色天天| 中文字幕欧美区| 粉嫩绯色av一区二区在线观看 | 久久午夜电影网| 99久久综合精品| 丁香六月久久综合狠狠色| 亚洲国产日产av| 国产欧美在线观看一区| 在线中文字幕不卡| 成人福利视频在线| 国产精品911| 日本免费新一区视频| 欧美在线观看禁18| 石原莉奈在线亚洲三区| 久久夜色精品国产噜噜av| av成人老司机| 亚洲18女电影在线观看| 久久久蜜桃精品| 粉嫩蜜臀av国产精品网站| 亚洲黄色录像片| 欧美一区欧美二区| 波波电影院一区二区三区| 欧美一区永久视频免费观看| 成人性生交大合| 久久99久久精品| 日本vs亚洲vs韩国一区三区| 国产尤物一区二区在线| 久久只精品国产| 欧美卡1卡2卡| 丁香桃色午夜亚洲一区二区三区 | 久久精品72免费观看| 久久久久久一二三区| 色哟哟欧美精品| 国产精品一二一区| 秋霞电影一区二区| 亚洲另类在线制服丝袜| 精品日韩欧美在线| 欧美剧情电影在线观看完整版免费励志电影| 国产成人啪午夜精品网站男同| 亚洲国产综合色| 亚洲色图欧美偷拍| 中文在线资源观看网站视频免费不卡 | 国内精品免费在线观看| 无吗不卡中文字幕| 亚洲在线成人精品| 一区二区日韩电影| 夜夜嗨av一区二区三区网页| 亚洲视频在线一区观看| 中文字幕日本不卡| 国产精品毛片高清在线完整版| 久久久亚洲欧洲日产国码αv| 欧美成人一区二区| 久久久蜜桃精品| 中文字幕一区av| 亚洲国产日日夜夜| 日韩制服丝袜av| 狠狠色狠狠色综合系列| 国产精品一区三区| bt欧美亚洲午夜电影天堂| 色视频成人在线观看免| 欧美日韩亚洲综合| 精品国产91久久久久久久妲己| 国产亚洲自拍一区| 亚洲日本va在线观看| 日韩 欧美一区二区三区| 精品伊人久久久久7777人| 9i在线看片成人免费| 欧美男生操女生| 欧美国产日韩精品免费观看| 亚洲一线二线三线久久久| 日韩中文字幕不卡| 成人福利视频网站| 欧美成人一区二区三区| 成人18视频日本| 欧美日韩国产在线观看| 欧美国产乱子伦| 日韩高清不卡在线| a亚洲天堂av| 中文字幕不卡在线播放| 久久国产精品色婷婷| 91福利在线免费观看| 国产欧美1区2区3区| 免费视频一区二区| 欧美三电影在线| 亚洲精品视频自拍| 91在线视频观看| 久久久精品人体av艺术| 蜜桃精品视频在线| 亚洲va天堂va国产va久| 精品成人一区二区三区四区| 91精品国产综合久久国产大片| 国产丝袜在线精品| 五月天激情综合| 26uuu久久综合| 国产99精品在线观看| 久久精品男人的天堂| 香蕉影视欧美成人| 欧美亚洲禁片免费| 久久久久久久久免费| 亚洲精品乱码久久久久久黑人| 亚洲精品精品亚洲| 捆绑调教一区二区三区| 色婷婷久久99综合精品jk白丝 | 在线免费观看一区| 色综合网色综合| 欧美日韩一区在线观看| 日韩欧美一二三| 2024国产精品| 亚洲桃色在线一区| 欧美绝品在线观看成人午夜影视| 亚洲成av人片在线| 成人午夜视频在线| 欧美成人欧美edvon| 亚洲一区二区偷拍精品| 色婷婷综合久久久久中文一区二区| 国产亚洲一区二区三区在线观看 | 欧亚一区二区三区| 日韩精品一区二区三区中文不卡| 亚洲精品国产第一综合99久久| 盗摄精品av一区二区三区| 日韩免费成人网| 色综合色狠狠综合色| 亚洲午夜在线电影| 亚洲欧美一区二区三区国产精品| 一本高清dvd不卡在线观看| 亚洲欧美日韩一区二区三区在线观看| 欧美在线一二三| 日韩电影免费一区| 亚洲小说春色综合另类电影| 日韩精品在线一区二区| 成人午夜伦理影院| 日韩—二三区免费观看av| 成人免费小视频| 国产日韩欧美亚洲| 4438成人网| 欧美色偷偷大香| 色系网站成人免费| 国产麻豆91精品| 亚洲午夜一区二区三区| 1000精品久久久久久久久| 久久久久久久久伊人| 欧美大胆一级视频| 91在线看国产| 欧美剧在线免费观看网站| 久久日韩精品一区二区五区| 久久色在线视频| 亚洲一区二区欧美激情| 日本视频免费一区| 欧美一二区视频| 精品免费视频.| 精品福利一区二区三区| 国产亚洲欧洲一区高清在线观看| 精品国产乱码久久久久久老虎 | 国产亚洲视频系列| 国产欧美一区二区在线| 亚洲欧美国产高清| 丝袜美腿亚洲综合| 狠狠色狠狠色综合| 成人av资源下载| 欧美午夜宅男影院| 欧美精品一区二区久久久| 中文字幕欧美日韩一区| 亚洲va天堂va国产va久| 久久99精品国产| 99精品欧美一区二区蜜桃免费 | 久久精品人人做| 亚洲日本在线看| 日韩二区在线观看| 91麻豆福利精品推荐| 精品久久久久久最新网址| 中文字幕永久在线不卡| 日韩国产精品久久| 99久久免费精品| 亚洲精品一区二区三区香蕉| 亚洲久草在线视频| 国产精品一级在线| 欧美精品视频www在线观看| 中文字幕制服丝袜一区二区三区| 亚洲成人精品一区| 欧美激情一区二区在线| 三级在线观看一区二区| 91蝌蚪porny九色| 国产精品久久久久一区二区三区| 日韩精品电影在线| 欧美日韩国产首页在线观看| 成人免费小视频| 99re6这里只有精品视频在线观看| 精品日产卡一卡二卡麻豆| 日韩精品欧美成人高清一区二区| 在线亚洲一区观看| 亚洲欧美日韩电影| 91高清在线观看| 亚洲一区二区三区影院| 欧美性一区二区| 亚洲va欧美va人人爽午夜|