From e68e6d4e433fe42a0c6df18b2f2d7990b91b7cd6 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 10 Dec 2022 21:26:05 -0600 Subject: add basic float_array parsing --- include/kalmia.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'include') 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 +#include /* 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 -- cgit v1.2.1