fixed.h

来自「wince 3d tutorial, it has various exampl」· C头文件 代码 · 共 24 行

H
24
字号
#ifndef FIXED_H
#define FIXED_H

const unsigned int PRECISION = 16;
const GLfixed ONE  = 1 << PRECISION;
const GLfixed ZERO = 0;

inline GLfixed FixedFromInt(int value) {return value << PRECISION;};
inline GLfixed FixedFromFloat(float value) {return static_cast<GLfixed>(value * static_cast<float>(ONE));};
inline GLfixed MultiplyFixed(GLfixed op1, GLfixed op2) 
{
  __int64 result = op1 * op2;
  return  (GLfixed)(result >> PRECISION);
};

inline GLfixed DivideFixed(GLfixed op1, GLfixed op2) 
{
  __int64  o1 = (__int64)op1 << PRECISION;
  __int64 result = o1 / (__int64)op2;
  return (GLfixed)result;
};


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?