/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
27 by Gustav Hartvigsson
* added skeleton for the SBox type.
1
#include "vec.h"
2
102 by Gustav Hartvigsson
* Finnished the Vectors... For the moment.
3
/* **************************************************************************
4
   **************** VEC3 (32bit int) ****************************************
5
   ************************************************************************** */
6
7
#define _V_NEW_M_(TYPE) {\
8
  TYPE * self = malloc (sizeof (TYPE));\
9
  self->a = a;\
10
  self->b = b;\
11
  self->c = c;\
12
  return self;\
13
}
14
15
#define _V_ADD_M_(TYPE) {\
16
  TYPE * new_v = malloc (sizeof (TYPE));\
17
  new_v->a = a->a + b->a;\
18
  new_v->b = a->b + b->b;\
19
  new_v->c = a->c + b->c;\
20
  return new_v;\
21
}
22
23
Vec3 *
24
vec3_new (sint a,
25
          sint b,
26
          sint c) {
27
  _V_NEW_M_(Vec3);
28
}
29
30
Vec3 *
31
vec3_add_vec3 (Vec3 * a,
32
               Vec3 * b) {
33
  _V_ADD_M_(Vec3);
34
}
35
36
Vec3 *
37
vec3_add_vec3_16 (Vec3 * a,
38
                  Vec3_16 * b) {
39
  _V_ADD_M_(Vec3);
40
}
41
42
Vec3 *
43
vec3_16_add_vec3 (Vec3_16 * a,
44
                  Vec3 * b) {
45
  _V_ADD_M_(Vec3);
46
}
47
48
/* **************************************************************************
49
   **************** VEC3_16 (16bit int) *************************************
50
   ************************************************************************** */
51
52
Vec3_16 *
53
vec3_16_new (sshort a,
54
             sshort b,
55
             sshort c) {
56
  _V_NEW_M_(Vec3_16);
57
}
58
59
Vec3_16 *
60
vec3_16_add_vec3_16 (Vec3_16 * a,
61
                     Vec3_16 * b) {
62
  _V_ADD_M_(Vec3_16);
63
}
64
65
66
/* **************************************************************************
67
   **************** VEC3_f (Float) ******************************************
68
   ************************************************************************** */
69
70
Vec3_f *
71
vec3_f_new (sfloat a,
72
            sfloat b,
73
            sfloat c) {
74
  _V_NEW_M_(Vec3_f);
75
}
76
77
Vec3_f *
78
vec3_f_add_vec3_f (Vec3_f * a,
79
                   Vec3_f * b) {
80
  _V_ADD_M_(Vec3_f);
81
}
82
83
Vec3_f *
84
vec3_f_add_vec3 (Vec3_f * a,
85
                 Vec3 * b) {
86
  _V_ADD_M_(Vec3_f);
87
}
88
89
Vec3_f *
90
vec3_f_add_vec3_16 (Vec3_f * a,
91
                    Vec3_16 * b) {
92
  _V_ADD_M_(Vec3_f);
93
}
94
95
Vec3_f *
96
vec3_add_vec3_f (Vec3 * a,
97
                Vec3_f * b) {
98
  _V_ADD_M_(Vec3_f);
99
}
100
101
Vec3_f *
102
vec3_16_add_vec3_f (Vec3_16 * a,
103
                   Vec3_f * b) {
104
  _V_ADD_M_(Vec3_f);
105
}
106