📄 util.h
字号:
/* * -*- Mode: ANSI C -*- * $Id: util.h,v 1.5 1996/08/16 17:23:30 fernande Exp $ * $Source: /sgi.acct/sweldens/cvs/liftpack/include/util.h,v $ * Author: Fernandez, Gabriel * * Contains common math functions and useful comparison functions. *//* do not edit anything above this line */#ifndef __UTIL_H__#define __UTIL_H__#include "flwtdef.h"extern Flt min3 ( Flt __a, Flt __b, Flt __c );extern Flt max3 ( Flt __a, Flt __b, Flt __c );extern Flt min4 ( Flt __a, Flt __b, Flt __c, Flt __d );extern Flt max4 ( Flt __a, Flt __b, Flt __c, Flt __d );extern int zeroEps ( const Flt __x, const Flt __eps );extern int zero ( const Flt __x );extern Flt logBaseN ( const Flt __x, const Flt __n );/* should be called only for positive powers of two */extern int logbasetwo ( int __x );/* called for nonnegative integers */extern int ispoweroftwo ( int __x );/* returns next n >= x such that n = 2^integer */extern int nextpoweroftwo( int __x );/* Useful macros */#define ABS(x) ((x) < (Flt)0 ? -(x) : (x))#define CEIL(num,den) ( ((num)+(den)-1)/(den) )#define EVEN(x) (!ODD(x))#define ODD(x) ((x) & 0x01)#define SIGN(x) ( (x) < 0 ? (-1) : ( (x) > 0 ? (1) ) : 0 )#define SQR(x) ( (x) * (x) )#define CUBE(x) ( (x) * (x) * (x) )#define ROUND(x,min,max) ( (x) > (Flt)(max) ? (Flt)(max) : (x) < (Flt)(min) ? (Flt)(min) : (x) + (Flt)0.5 )/* LUMA returns total intensity of r,g,b triple (i = .299R + .587G + .114B) */#define LUMA(rd,gn,bl) ( (int)((Flt)(rd)*(Flt)0.299 + (Flt)(gn)*(Flt)0.587 + (Flt)(bl)*(Flt)0.114) )#ifndef MAX#define MAX(a,b) ((a) > (b) ? (a) : (b))#endif#ifndef MIN#define MIN(a,b) ((a) < (b) ? (a) : (b))#endif#endif /* __UTIL_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -