Big number, big float and decimal fraction rework
New set of functions for big numbers, big floats and decimal fractions to have naming consistency. The old ones are still supported.
This is backwards compatible with QBOR v1. Previous work on v2 big numbers were not. This regains compatibility.
Offset of one for negative numbers is consistency supported for big numbers, big floats and decimal fractions.
Support for preferred serialization of big numbers including big floats and decimal fraction. No-preferred and raw options are provided too.
Prefer "BigNumber" to "bignum" and variants in function and variable naming
Add UsefulBuf_SkipLeading()
Separate definition of QCBORExpAndMantissa for readability of code.
* Big number rework (check point; not tested yet)
* Lots more reworking; tests passing (checkpoint)
* More big number rework
* Big number documentation and code tidy
* documentation and tidy
* GetNext handles 65 bit negs in exp and float...
* Fixes -- tests are passing now
* Fix disabled tags
* Check point; big function rename and fan out
* Lots of cross checking and small fixes
* Fix full test fan out
* Remove some redundant/left-over commas
* relocate expAndMantissa definition for clarity
---------
Co-authored-by: Laurence Lundblade <lgl@securitytheory.com>
diff --git a/src/UsefulBuf.c b/src/UsefulBuf.c
index 25a92f4..46b66c6 100644
--- a/src/UsefulBuf.c
+++ b/src/UsefulBuf.c
@@ -161,6 +161,24 @@
/*
* Public function -- see UsefulBuf.h
+ */
+UsefulBufC
+UsefulBuf_SkipLeading(UsefulBufC String, uint8_t uByte)
+{
+ for(;String.len; String.len--) {
+ if(*(const uint8_t *)String.ptr != uByte) {
+ break;
+ }
+ String.ptr = (const uint8_t *)String.ptr + 1;
+ }
+
+ return String;
+}
+
+
+
+/*
+ * Public function -- see UsefulBuf.h
*
* Code Reviewers: THIS FUNCTION DOES POINTER MATH
*/