diff options
author | sanine <sanine.not@pm.me> | 2022-12-10 21:26:05 -0600 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-12-10 21:26:05 -0600 |
commit | e68e6d4e433fe42a0c6df18b2f2d7990b91b7cd6 (patch) | |
tree | 823ba0a5f0f062692d04f32dfb2b26240fd71a7b /include/kalmia.h | |
parent | 7c47f23ee92afa07c748700f1de22fd8b8ccf967 (diff) |
add basic float_array parsing
Diffstat (limited to 'include/kalmia.h')
-rw-r--r-- | include/kalmia.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/kalmia.h b/include/kalmia.h index 31aff1e..48a608f 100644 --- a/include/kalmia.h +++ b/include/kalmia.h @@ -45,7 +45,7 @@ #ifndef KALMIA_H #define KALMIA_H -#include <stddef.h> +#include <stdlib.h> /* kalmia uses semantic versioning (semver.org) */ #define KALMIA_VERSION_MAJOR 0 @@ -53,6 +53,16 @@ #define KALMIA_VERSION_PATCH 0 +/* determine precision */ +#ifdef KALMIA_USE_DOUBLE +typedef double ka_real_t; +#define KA_STR_TO_REAL(nptr, end) strtod(nptr, end) +#else +typedef float ka_real_t; +#define KA_STR_TO_REAL(nptr, end) strtof(nptr, end) +#endif + + /* internal buffer size for strings/sids */ #ifndef KA_BUF_SIZE #define KA_BUF_SIZE 128 @@ -61,6 +71,8 @@ /* format data structures */ -typedef double ka_matrix_t[16]; +typedef ka_real_t ka_matrix_t[16]; + + #endif |