From 61a8f418b26a2d974e38e4ae55020aca8d402d88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 7 Jun 2017 20:36:01 +0400 Subject: qnum: add uint type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to store integer values between INT64_MAX and UINT64_MAX, add a uint64_t internal representation. Signed-off-by: Marc-André Lureau Reviewed-by: Markus Armbruster Message-Id: <20170607163635.17635-10-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- include/qapi/qmp/qnum.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/qapi/qmp/qnum.h') 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); -- cgit v1.2.3