Add compile option to disable floating point usage (#114)
This commit adds the option to disable floating point processing in
QCBOR. To disable, the USEFULBUF_DISABLE_ALL_FLOAT preprocessor macro
needs to be defined.
e.g.:
$ make CMD_LINE="-DUSEFULBUF_DISABLE_ALL_FLOAT"
This removes the capability (and the code) of decoding floating point
types. The type is still recognised, so a meaningful
QCBOR_ERR_ALL_FLOAT_DISABLED error is returned when a floating point value
is encountered in a decoded qcbor. From the encoding interface the
floating point encoding functions are removed.
Change-Id: I371769246f7d83354607de9bce1e7998b8c536a1
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/src/ieee754.c b/src/ieee754.c
index 216cd00..a8079f8 100644
--- a/src/ieee754.c
+++ b/src/ieee754.c
@@ -2,6 +2,7 @@
ieee754.c -- floating-point conversion between half, double & single-precision
Copyright (c) 2018-2020, Laurence Lundblade. All rights reserved.
+ Copyright (c) 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
@@ -10,6 +11,12 @@
Created on 7/23/18
=============================================================================*/
+/*
+ Include before QCBOR_DISABLE_PREFERRED_FLOAT is checked as
+ QCBOR_DISABLE_PREFERRED_FLOAT might be defined in qcbor/qcbor_common.h
+ */
+#include "qcbor/qcbor_common.h"
+
#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
#include "ieee754.h"