aboutsummaryrefslogtreecommitdiff
path: root/include/qapi/qmp/qnum.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 20:36:01 +0400
committerMarkus Armbruster <armbru@redhat.com>2017-06-20 14:31:31 +0200
commit61a8f418b26a2d974e38e4ae55020aca8d402d88 (patch)
tree3d0247aa5282793a911b8c699ae7c2da5772e50c /include/qapi/qmp/qnum.h
parent36aeb6094f04bed036c43c5e0eb675ca78bf72fe (diff)
qnum: add uint type
In order to store integer values between INT64_MAX and UINT64_MAX, add a uint64_t internal representation. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20170607163635.17635-10-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'include/qapi/qmp/qnum.h')
-rw-r--r--include/qapi/qmp/qnum.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/qapi/qmp/qnum.h b/include/qapi/qmp/qnum.h
index e42b136141..09d745c490 100644
--- a/include/qapi/qmp/qnum.h
+++ b/include/qapi/qmp/qnum.h
@@ -19,6 +19,7 @@
typedef enum {
QNUM_I64,
+ QNUM_U64,
QNUM_DOUBLE
} QNumKind;
@@ -27,15 +28,21 @@ typedef struct QNum {
QNumKind kind;
union {
int64_t i64;
+ uint64_t u64;
double dbl;
} u;
} QNum;
QNum *qnum_from_int(int64_t value);
+QNum *qnum_from_uint(uint64_t value);
QNum *qnum_from_double(double value);
bool qnum_get_try_int(const QNum *qn, int64_t *val);
int64_t qnum_get_int(const QNum *qn);
+
+bool qnum_get_try_uint(const QNum *qn, uint64_t *val);
+uint64_t qnum_get_uint(const QNum *qn);
+
double qnum_get_double(QNum *qn);
char *qnum_to_string(QNum *qn);