diff options
| author | JoJoBond <jojobond@hotmail.com> | 2010-11-05 21:28:04 (GMT) |
|---|---|---|
| committer | JoJoBond <jojobond@hotmail.com> | 2010-11-05 21:28:04 (GMT) |
| commit | 891774a7e2935a2e82eba8dd51a8f9782b407149 (patch) | |
| tree | 75399c741be7486e42e88d4d5c88089a4ceb9c2d /includes/misc.h | |
| parent | 9b8acd9259f67c9efa8125538c91b6108e4155d3 (diff) | |
| parent | 6124922b9f47003e4935580d792b7ba3b8ba1ede (diff) | |
| download | powder-891774a7e2935a2e82eba8dd51a8f9782b407149.zip powder-891774a7e2935a2e82eba8dd51a8f9782b407149.tar.gz | |
Merge branch 'master' of github.com:JoJoBond/The-Powder-Toy
Diffstat (limited to 'includes/misc.h')
| -rw-r--r-- | includes/misc.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/includes/misc.h b/includes/misc.h new file mode 100644 index 0000000..9a92a71 --- /dev/null +++ b/includes/misc.h @@ -0,0 +1,72 @@ +#ifndef UTILS_H +#define UTILS_H +#include <stdio.h> +#include <stdlib.h> + +#if defined(WIN32) && !defined(__GNUC__) +#define x86_cpuid(func,af,bf,cf,df) \ + do {\ + __asm mov eax, func\ + __asm cpuid\ + __asm mov af, eax\ + __asm mov bf, ebx\ + __asm mov cf, ecx\ + __asm mov df, edx\ + } while(0) +#else +#define x86_cpuid(func,af,bf,cf,df) \ +__asm__ __volatile ("cpuid":\ + "=a" (af), "=b" (bf), "=c" (cf), "=d" (df) : "a" (func)); +#endif + +static char hex[] = "0123456789ABCDEF"; +//Signum function +#ifdef WIN32 +extern _inline int isign(float i); +#else +extern inline int isign(float i); +#endif + +#ifdef WIN32 +extern _inline unsigned clamp_flt(float f, float min, float max); +#else +extern inline unsigned clamp_flt(float f, float min, float max); +#endif + +#ifdef WIN32 +extern _inline float restrict_flt(float f, float min, float max); +#else +extern inline float restrict_flt(float f, float min, float max); +#endif + +char *mystrdup(char *s); + +struct strlist +{ + char *str; + struct strlist *next; +}; + +void strlist_add(struct strlist **list, char *str); + +int strlist_find(struct strlist **list, char *str); + +void strlist_free(struct strlist **list); + +void save_presets(int do_update); + +void load_presets(void); + +void save_string(FILE *f, char *str); + +int load_string(FILE *f, char *str, int max); + +void strcaturl(char *dst, char *src); + +void strappend(char *dst, char *src); + +void *file_load(char *fn, int *size); + +int cpu_check(void); + +#endif
\ No newline at end of file |
