QUDA
v0.5.0
A library for QCD on GPUs
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
quda
tests
short.h
Go to the documentation of this file.
1
#ifndef _SHORT_H
2
#define _SHORT_H
3
4
#define SHORT_LENGTH 65536
5
#define SCALE_FLOAT ((SHORT_LENGTH-1) * 0.5)
6
#define SHIFT_FLOAT (-1.f / (SHORT_LENGTH-1))
7
8
template
<
typename
Float>
9
inline
short
FloatToShort
(
Float
a) {
10
//return (short)(a*MAX_SHORT);
11
short
rtn = (short)((a+
SHIFT_FLOAT
)*
SCALE_FLOAT
);
12
return
rtn;
13
}
14
15
template
<
typename
Float>
16
inline
Float
shortToFloat
(
short
a) {
17
Float
rtn = (float)a/
SCALE_FLOAT
-
SHIFT_FLOAT
;
18
return
rtn;
19
}
20
21
#endif // _SHORT_H
Generated on Wed Mar 20 2013 12:52:18 for QUDA by
1.8.2