2017-11-24 15:14:10 +01:00
|
|
|
/*
|
2019-08-03 19:43:48 +02:00
|
|
|
* This software is licensed under the terms of the MIT License.
|
2017-11-24 15:14:10 +01:00
|
|
|
* See COPYING for further information.
|
|
|
|
* ---
|
2019-01-23 21:10:43 +01:00
|
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
2019-07-03 20:00:56 +02:00
|
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@taisei-project.org>.
|
2017-11-24 15:14:10 +01:00
|
|
|
*/
|
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#ifndef IGUARD_util_crap_h
|
|
|
|
#define IGUARD_util_crap_h
|
|
|
|
|
2017-11-25 20:45:11 +01:00
|
|
|
#include "taisei.h"
|
2017-11-24 15:14:10 +01:00
|
|
|
|
2019-03-16 21:11:37 +01:00
|
|
|
#include <SDL.h>
|
|
|
|
|
2019-08-04 00:29:41 +02:00
|
|
|
void* memdup(const void *src, size_t size) attr_returns_allocated attr_nonnull(1);
|
|
|
|
void inherit_missing_pointers(uint num, void *dest[num], void *const base[num]) attr_nonnull(2, 3);
|
2019-01-09 04:25:10 +01:00
|
|
|
bool is_main_thread(void);
|
2019-01-23 21:10:43 +01:00
|
|
|
|
2019-08-03 18:47:21 +02:00
|
|
|
INLINE uint32_t float_to_bits(float f) {
|
2019-04-07 00:55:13 +02:00
|
|
|
union { uint32_t i; float f; } u;
|
|
|
|
u.f = f;
|
|
|
|
return u.i;
|
|
|
|
}
|
|
|
|
|
2019-08-03 18:47:21 +02:00
|
|
|
INLINE float bits_to_float(uint32_t i) {
|
2019-04-07 00:55:13 +02:00
|
|
|
union { uint32_t i; float f; } u;
|
|
|
|
u.i = i;
|
|
|
|
return u.f;
|
|
|
|
}
|
|
|
|
|
2019-03-16 21:11:37 +01:00
|
|
|
extern SDL_threadID main_thread_id;
|
|
|
|
|
2019-02-22 00:56:03 +01:00
|
|
|
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*(arr)))
|
|
|
|
|
2019-01-23 21:10:43 +01:00
|
|
|
#endif // IGUARD_util_crap_h
|