WIL説明書(C++)  3.0.0
FvMathTemplate.h
[詳解]
1 // $Revision: 1.1 $
2 /*
3  @file FvMathTemplate.h
4  @brief Math template functions
5  @author FAST Corporation
6 */
7 
8 
9 #ifndef _FVMATHTEMPLATE_H_INCLUDED_
10 #define _FVMATHTEMPLATE_H_INCLUDED_
11 
12 #include "FvMacros.h"
13 #include "FvDefs.h"
14 
15 namespace FVCL
16 {
17 
19 // Math
20 namespace Math
21 {
22 
23 template<class Type> Type Max( Type _Left, Type _Right )
24 {
25  return ((_Left>_Right) ? _Left : _Right);
26 }
27 
28 template<class Type> Type Min( Type _Left, Type _Right )
29 {
30  return ((_Left<_Right) ? _Left : _Right);
31 }
32 
33 template<class TD, class TS> void BitShiftR( TD* dst, TS src, INT shift )
34 {
35  if( shift > 0 ) *dst = (TD)( src >> shift ); // right
36  else if( shift < 0 ) *dst = ( (TD)src << -shift ); // reverse
37  else *dst = (TD)( src );
38 }
39 template<class TD, class TS> void BitShiftL( TD* dst, TS src, INT shift )
40 {
41  if( shift > 0 ) *dst = ( (TD)src << shift ); // left
42  else if( shift < 0 ) *dst = (TD)( src >> -shift ); // reverse
43  else *dst = (TD)( src );
44 }
45 
46 } // Math
47 } // FVCL
48 
49 #endif // _FVMATHTEMPLATE_H_INCLUDED_
FVCLのネームスペース
Definition: EVCbasicDeclare.txt:9
int INT
整数型(32ビット)
Definition: FvDefs.h:36
void BitShiftL(TD *dst, TS src, INT shift)
ビットシフト(左)
Definition: FvMathTemplate.h:39
マクロ定義
Type Max(Type _Left, Type _Right)
オブジェクトの大小比較
Definition: FvMathTemplate.h:23
Type Min(Type _Left, Type _Right)
オブジェクトの大小比較
Definition: FvMathTemplate.h:28
変数型と定数の定義
void BitShiftR(TD *dst, TS src, INT shift)
ビットシフト(右)
Definition: FvMathTemplate.h:33

Documentation copyright © 2007 FAST Corporation. [B-001864]
Generated on 2023年11月02日(木) 10時12分53秒 for WIL説明書(C++) by doxygen 1.8.11