Program listing for file numerics/src/tools/NumericsDataVersion.h#
Return to documentation for this file
1#ifndef NumericsDataVersion_h
2#define NumericsDataVersion_h
3
4#include <assert.h>
5#include <limits.h>
6#include <stdint.h>
7
8typedef uint64_t version_t;
9
10
11typedef struct {
12 version_t number;
13} NumericsDataVersion;
14
15static inline version_t NDV_value(const NumericsDataVersion* v) { return v->number; }
16
17static inline void NDV_set_value(NumericsDataVersion* v, version_t value) {
18 v->number = value;
19}
20
21static inline void NDV_reset(NumericsDataVersion* v) { v->number = 0; }
22
23static inline void NDV_inc(NumericsDataVersion* v) {
24 assert(v->number < UINT64_MAX);
25 v->number += 1;
26}
27
28#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
29extern "C" {
30#endif
31
32#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
33}
34#endif
35
36#endif