d230aef4f854ea10818b47b2bc41c8115a2e6f63
[GPU.git] / IndiceTools_GPU.h
1 #ifndef INDICES_TOOLS_GPU_H_
2 #define INDICES_TOOLS_GPU_H_
3
4 #include "both_define.h"
5
6 /*----------------------------------------------------------------------*\
7 |* Declaration *|
8 \*---------------------------------------------------------------------*/
9
10 /*--------------------------------------*\
11 |* Public *|
12 \*-------------------------------------*/
13
14 namespace gpu
15 {
16 class IndiceTools
17 {
18
19 /*--------------------------------------*\
20 |* Constructor *|
21 \*--------------------------------------*/
22
23 public:
24
25 /*--------------------------------------*\
26 |* Methodes *|
27 \*--------------------------------------*/
28
29 public:
30
31 /**
32 * s[0,W*H[ --> i[0,H[ j[0,W[
33 * w = largeur
34 * h = hauteur
35 */
36 __BOTH__
37 static void toIJ( int s, int w, int* ptrI, int* ptrJ)
38 {
39 *ptrI = s / w;
40 *ptrJ = s - w * (*ptrI);
41 }
42
43 /**
44 * i[0,H[ j[0,W[ --> s[0,W*H[
45 * w = largeur
46 * h = hauteur
47 */
48 __BOTH__
49 static int toS(int w, int i, int j)
50 {
51 return (i * w) + j;
52 }
53
54 /*-------------------------------------*\
55 |* Attributs *|
56 \*-------------------------------------*/
57
58 private:
59
60 };
61 }
62
63 #endif
64
65 /*----------------------------------------------------------------------*\
66 |* End *|
67 \*---------------------------------------------------------------------*/