diff options
author | mannol <eniz_vukovic@hotmail.com> | 2014-05-31 17:27:22 +0200 |
---|---|---|
committer | mannol <eniz_vukovic@hotmail.com> | 2014-05-31 17:27:22 +0200 |
commit | d7c11573751eea005d3b1938ae3298c265d48fd6 (patch) | |
tree | 5e24378192854d147e42fd2c44e0a7bd53685bc4 /toxcore/util.h | |
parent | 2ebefb85b7f5ae28db1e8c11196467efd3c914cf (diff) |
Fixed byte order and removed log functions from misc_tools
Diffstat (limited to 'toxcore/util.h')
-rw-r--r-- | toxcore/util.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/toxcore/util.h b/toxcore/util.h index e40b6968..71c2f5c7 100644 --- a/toxcore/util.h +++ b/toxcore/util.h | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <stdbool.h> | 28 | #include <stdbool.h> |
29 | #include <stdint.h> | 29 | #include <stdint.h> |
30 | 30 | ||
31 | #define inline__ inline __attribute__((always_inline)) | ||
32 | |||
31 | void unix_time_update(); | 33 | void unix_time_update(); |
32 | uint64_t unix_time(); | 34 | uint64_t unix_time(); |
33 | int is_timeout(uint64_t timestamp, uint64_t timeout); | 35 | int is_timeout(uint64_t timestamp, uint64_t timeout); |
@@ -45,4 +47,17 @@ typedef int (*load_state_callback_func)(void *outer, uint8_t *data, uint32_t len | |||
45 | int load_state(load_state_callback_func load_state_callback, void *outer, | 47 | int load_state(load_state_callback_func load_state_callback, void *outer, |
46 | uint8_t *data, uint32_t length, uint16_t cookie_inner); | 48 | uint8_t *data, uint32_t length, uint16_t cookie_inner); |
47 | 49 | ||
50 | /* Converts 4 bytes to uint32_t */ | ||
51 | void bytes_to_U32(uint32_t *dest, const uint8_t *bytes); | ||
52 | |||
53 | /* Converts 2 bytes to uint16_t */ | ||
54 | void bytes_to_U16(uint16_t *dest, const uint8_t *bytes); | ||
55 | |||
56 | /* Convert uint32_t to byte string of size 4 */ | ||
57 | void U32_to_bytes(uint8_t *dest, uint32_t value); | ||
58 | |||
59 | /* Convert uint16_t to byte string of size 2 */ | ||
60 | void U16_to_bytes(uint8_t *dest, uint16_t value); | ||
61 | |||
62 | |||
48 | #endif /* __UTIL_H__ */ | 63 | #endif /* __UTIL_H__ */ |