Decode conformance for preferred serialization, CDE and dCBOR (#216)
Three conformance modes are added for decoding
- preferred serialization
- CDE
- dCBOR
This checks for sort ordering and duplicate labels when a map is decoded in CDE and dCBOR modes.
It does not support arrays and maps as map labels. They will error out, unless you use maps-as-arrays mode.
Conformance includes checking for shortest form of integers and floats and for dCBOR unification of floats and integers.
* start work on dCBOR decoding enforcement
* checkpoint
* Floating point conformane; ifdef for disabling
* Add more tests
* More dCBOR tests and conformance checks
* More test cases
* Bug fixes and more tests
* Check point stuff
* Map dup and sort order checking kind of working
* more work...
* Finish off UsefulInputBuf_Compare()
* Fix #ifdef fanout
* Fix warnings and #ifdef fan out
* sort & dup checking working and tested
* Fix test ifdef fan out
* Minor fix of one test case
* Another fan out fix
* backout map label checking; doc; test
* Stragglers
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/src/ieee754.c b/src/ieee754.c
index 69bf113..f9b7a3f 100644
--- a/src/ieee754.c
+++ b/src/ieee754.c
@@ -875,7 +875,7 @@
/* Public function; see ieee754.h */
int
-IEEE754_IsNotStandardDoubleNaN(const double d)
+IEEE754_DoubleHasNaNPayload(const double d)
{
const uint64_t uDouble = CopyDoubleToUint64(d);
const uint64_t uDoubleBiasedExponent = (uDouble & DOUBLE_EXPONENT_MASK) >> DOUBLE_EXPONENT_SHIFT;
@@ -895,19 +895,20 @@
/* Public function; see ieee754.h */
int
-IEEE754_IsNotStandardSingleNaN(const float f)
+IEEE754_SingleHasNaNPayload(const float f)
{
const uint32_t uSingle = CopyFloatToUint32(f);
const uint32_t uSingleBiasedExponent = (uSingle & SINGLE_EXPONENT_MASK) >> SINGLE_EXPONENT_SHIFT;
/* Cast safe because of mask above; exponents < SINGLE_EXPONENT_MAX */
const int32_t nSingleUnbiasedExponent = (int32_t)uSingleBiasedExponent - SINGLE_EXPONENT_BIAS;
- const uint32_t uSingleleSignificand = uSingle & SINGLE_SIGNIFICAND_MASK;
+ const uint32_t uSingleSignificand = uSingle & SINGLE_SIGNIFICAND_MASK;
if(nSingleUnbiasedExponent == SINGLE_EXPONENT_INF_OR_NAN &&
- uSingleleSignificand != 0 &&
- uSingleleSignificand != SINGLE_QUIET_NAN_BIT) {
+ uSingleSignificand != 0 &&
+ uSingleSignificand != SINGLE_QUIET_NAN_BIT) {
return 1;
} else {
return 0;
}
}
+