commit b684e2be2d5a9e76636437c9e4ee855c127c0987
parent 1e81caca9b8630abfd7b1d5cf2e102dd60503a10
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 7 Jan 2022 10:55:02 +0100
Add null constants to the smc data structures
Diffstat:
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/smc.h b/src/smc.h
@@ -74,9 +74,8 @@ struct smc_type {
void (*divi)(void* result, const void* op0, const size_t op1);
void (*sqrt)(void* result, const void* value);
};
-
-static const struct smc_type SMC_TYPE_NULL =
-{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+#define SMC_TYPE_NULL__ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}
+static const struct smc_type SMC_TYPE_NULL = SMC_TYPE_NULL__;
struct smc_estimator_status {
void* E; /* Expected value */
@@ -85,6 +84,9 @@ struct smc_estimator_status {
size_t N; /* OK samples count */
size_t NF; /* Failed samples count */
};
+#define SMC_ESTIMATOR_STATUS_NULL__ {NULL, NULL, NULL, 0, 0}
+static const struct smc_estimator_status SMC_ESTIMATOR_STATUS_NULL =
+ SMC_ESTIMATOR_STATUS_NULL__;
struct smc_integrator {
res_T (*integrand)
@@ -93,9 +95,8 @@ struct smc_integrator {
size_t max_realisations; /* Maximum # of realisations */
size_t max_failures; /* Cancel integration past # failed samples */
};
-
-static const struct smc_integrator SMC_INTEGRATOR_NULL =
-{ NULL, NULL, SIZE_MAX, SIZE_MAX };
+#define SMC_INTEGRATOR_NULL__ {NULL, NULL, 0, 0}
+static const struct smc_integrator SMC_INTEGRATOR_NULL = SMC_INTEGRATOR_NULL__;
/* Forward declaration of opaque types */
struct smc_device; /* Entry point of the library */
@@ -115,6 +116,9 @@ struct smc_doubleN_context {
size_t count; /* Number of floating point values */
void* integrand_data; /* User defined data used by the integrand */
};
+#define SMC_DOUBLEN_CONTEXT_NULL__ {0, NULL}
+static const struct smc_doubleN_context SMC_DOUBLEN_CONTEXT_NULL =
+ SMC_DOUBLEN_CONTEXT_NULL__;
/* Syntactic sugar macros and functions */
#define SMC_FLOAT(Val) (*(float*)(Val))