… | |
… | |
18 | * <http://www.gnu.org/licenses/>. |
18 | * <http://www.gnu.org/licenses/>. |
19 | * |
19 | * |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
20 | * The authors can be reached via e-mail to <support@deliantra.net> |
21 | */ |
21 | */ |
22 | |
22 | |
|
|
23 | /* define traits (actually just types at the moment) for basic types */ |
|
|
24 | |
23 | #ifndef TRAITS_H__ |
25 | #ifndef TRAITS_H__ |
24 | #define TRAITS_H__ |
26 | #define TRAITS_H__ |
25 | |
27 | |
26 | #include <inttypes.h> |
28 | #include <inttypes.h> |
27 | |
29 | |
… | |
… | |
32 | typedef int32_t sint32; |
34 | typedef int32_t sint32; |
33 | typedef uint32_t uint32; |
35 | typedef uint32_t uint32; |
34 | typedef int64_t sint64; |
36 | typedef int64_t sint64; |
35 | typedef uint64_t uint64; |
37 | typedef uint64_t uint64; |
36 | |
38 | |
|
|
39 | typedef uint32 weight_t; |
|
|
40 | typedef sint64 volume_t; |
37 | typedef uint32_t tick_t; |
41 | typedef uint32 tick_t; |
38 | typedef uint16_t faceidx; |
42 | typedef uint16 faceidx; |
|
|
43 | |
|
|
44 | inline weight_t |
|
|
45 | weight_to_kg_approx (weight_t w) |
|
|
46 | { |
|
|
47 | // we divide by 1024, because otherwise we need a 64 bit multiply |
|
|
48 | return w >> 10; |
|
|
49 | } |
39 | |
50 | |
40 | const int sint32_digits = 11; // number of digits an sint32 uses max. |
51 | const int sint32_digits = 11; // number of digits an sint32 uses max. |
41 | const int sint64_digits = 20; |
52 | const int sint64_digits = 20; |
42 | |
53 | |
43 | typedef char *octet_string; |
54 | typedef char *octet_string; |