diff options
Diffstat (limited to 'src/cn-create.c')
-rw-r--r-- | src/cn-create.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cn-create.c b/src/cn-create.c index bc448e9..4ddce3b 100644 --- a/src/cn-create.c +++ b/src/cn-create.c @@ -73,6 +73,34 @@ cn_cbor* cn_cbor_int_create(int64_t value return ret; } +#ifndef CBOR_NO_FLOAT +cn_cbor* cn_cbor_float_create(float value + CBOR_CONTEXT, + cn_cbor_errback *errp) +{ + cn_cbor* ret; + INIT_CB(ret); + + ret->type = CN_CBOR_FLOAT; + ret->v.f = value; + + return ret; +} + +cn_cbor* cn_cbor_double_create(double value + CBOR_CONTEXT, + cn_cbor_errback *errp) +{ + cn_cbor* ret; + INIT_CB(ret); + + ret->type = CN_CBOR_DOUBLE; + ret->v.dbl = value; + + return ret; +} +#endif /* CBOR_NO_FLOAT */ + static bool _append_kv(cn_cbor *cb_map, cn_cbor *key, cn_cbor *val) { //Connect key and value and insert them into the map. |