QCBOR
Loading...
Searching...
No Matches
qcbor_number_encode.h
Go to the documentation of this file.
1/* ===========================================================================
2 * Copyright (c) 2016-2018, The Linux Foundation.
3 * Copyright (c) 2018-2024, Laurence Lundblade.
4 * Copyright (c) 2021, Arm Limited.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials provided
15 * with the distribution.
16 * * Neither the name of The Linux Foundation nor the names of its
17 * contributors, nor the name "Laurence Lundblade" may be used to
18 * endorse or promote products derived from this software without
19 * specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
28 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * ========================================================================= */
33
34#ifndef qcbor_number_encode_h
35#define qcbor_number_encode_h
36
37
38#include "qcbor/qcbor_common.h"
39#include "qcbor/qcbor_private.h"
41#include <stdbool.h>
42
43
44#ifdef __cplusplus
45extern "C" {
46#if 0
47} // Keep editor indention formatting happy
48#endif
49#endif
50
51
131#define QCBOR_HEAD_BUFFER_SIZE (sizeof(uint64_t) + 2)
132
133
134
135
176void
178
180static void
181QCBOREncode_AddInt64ToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nNum);
182
184static void
185QCBOREncode_AddInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, int64_t nNum);
186
187
202static void
203QCBOREncode_AddUInt64(QCBOREncodeContext *pCtx, uint64_t uNum);
204
206static void
207QCBOREncode_AddUInt64ToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum);
208
210static void
211QCBOREncode_AddUInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint64_t uNum);
212
213
250static void
252
254static void
255QCBOREncode_AddNegativeUInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum);
256
258static void
259QCBOREncode_AddNegativeUInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint64_t uNum);
260
261
262#ifndef USEFULBUF_DISABLE_ALL_FLOAT
308static void
309QCBOREncode_AddDouble(QCBOREncodeContext *pCtx, double dNum);
310
312static void
313QCBOREncode_AddDoubleToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, double dNum);
314
316static void
317QCBOREncode_AddDoubleToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, double dNum);
318
319
332static void
334
336static void
337QCBOREncode_AddFloatToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, float fNum);
338
340static void
341QCBOREncode_AddFloatToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, float dNum);
342
343
358static void
360
362static void
363QCBOREncode_AddDoubleNoPreferredToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, double dNum);
364
366static void
367QCBOREncode_AddDoubleNoPreferredToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, double dNum);
368
369
384static void
386
388static void
389QCBOREncode_AddFloatNoPreferredToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, float fNum);
390
392static void
393QCBOREncode_AddFloatNoPreferredToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, float fNum);
394#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
395
396
397
411static void
413
415static void
417
419static void
421
422
454void
456
458static void
460 const char *szLabel,
461 UsefulBuf *pPlace);
462
464static void
466 int64_t nLabel,
467 UsefulBuf *pPlace);
468
469
484void
486
487
521static void
523 uint8_t uTagRequirement,
524 bool bNegative,
525 UsefulBufC BigNumber);
526
528static void
530 const char *szLabel,
531 uint8_t uTagRequirement,
532 bool bNegative,
533 UsefulBufC BigNumber);
534
536static void
538 int64_t nLabel,
539 uint8_t uTagRequirement,
540 bool bNegative,
541 UsefulBufC BigNumber);
542
543
566static void
568 uint8_t uTagRequirement,
569 bool bNegative,
570 UsefulBufC BigNumber);
571
573static void
575 const char *szLabel,
576 uint8_t uTagRequirement,
577 bool bNegative,
578 UsefulBufC BigNumber);
579
581static void
583 int64_t nLabel,
584 uint8_t uTagRequirement,
585 bool bNegative,
586 UsefulBufC BigNumber);
587
588
620static void
622 uint8_t uTagRequirement,
623 bool bNegative,
624 UsefulBufC BigNumber);
625
627static void
629 const char *szLabel,
630 uint8_t uTagRequirement,
631 bool bNegative,
632 UsefulBufC BigNumber);
633
635static void
637 int64_t nLabel,
638 uint8_t uTagRequirement,
639 bool bNegative,
640 UsefulBufC BigNumber);
641
642
643
644#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
685static void
687 uint8_t uTagRequirement,
688 int64_t nMantissa,
689 int64_t nBase10Exponent);
690
692static void
694 const char *szLabel,
695 uint8_t uTagRequirement,
696 int64_t nMantissa,
697 int64_t nBase10Exponent);
698
700static void
702 int64_t nLabel,
703 uint8_t uTagRequirement,
704 int64_t nMantissa,
705 int64_t nBase10Exponent);
706
707
708
735static void
737 uint8_t uTagRequirement,
738 UsefulBufC Mantissa,
739 bool bIsNegative,
740 int64_t nBase10Exponent);
741
743static void
745 const char *szLabel,
746 uint8_t uTagRequirement,
747 UsefulBufC Mantissa,
748 bool bIsNegative,
749 int64_t nBase10Exponent);
750
752static void
754 int64_t nLabel,
755 uint8_t uTagRequirement,
756 UsefulBufC Mantissa,
757 bool bIsNegative,
758 int64_t nBase10Exponent);
771static void
773 uint8_t uTagRequirement,
774 UsefulBufC Mantissa,
775 bool bIsNegative,
776 int64_t nBase10Exponent);
777
779static void
781 const char *szLabel,
782 uint8_t uTagRequirement,
783 UsefulBufC Mantissa,
784 bool bIsNegative,
785 int64_t nBase10Exponent);
786
788static void
790 int64_t nLabel,
791 uint8_t uTagRequirement,
792 UsefulBufC Mantissa,
793 bool bIsNegative,
794 int64_t nBase10Exponent);
795
796
797
835static void
837 uint8_t uTagRequirement,
838 int64_t nMantissa,
839 int64_t nBase2Exponent);
840
842static void
844 const char *szLabel,
845 uint8_t uTagRequirement,
846 int64_t nMantissa,
847 int64_t nBase2Exponent);
848
850static void
852 int64_t nLabel,
853 uint8_t uTagRequirement,
854 int64_t nMantissa,
855 int64_t nBase2Exponent);
856
857
879static void
881 uint8_t uTagRequirement,
882 UsefulBufC Mantissa,
883 bool bIsNegative,
884 int64_t nBase2Exponent);
885
887static void
889 const char *szLabel,
890 uint8_t uTagRequirement,
891 UsefulBufC Mantissa,
892 bool bIsNegative,
893 int64_t nBase2Exponent);
894
896static void
898 int64_t nLabel,
899 uint8_t uTagRequirement,
900 UsefulBufC Mantissa,
901 bool bIsNegative,
902 int64_t nBase2Exponent);
903
904
918static void
920 uint8_t uTagRequirement,
921 UsefulBufC Mantissa,
922 bool bIsNegative,
923 int64_t nBase2Exponent);
924
925
927static void
929 const char *szLabel,
930 uint8_t uTagRequirement,
931 UsefulBufC Mantissa,
932 bool bIsNegative,
933 int64_t nBase2Exponent);
934
936static void
938 int64_t nLabel,
939 uint8_t uTagRequirement,
940 UsefulBufC Mantissa,
941 bool bIsNegative,
942 int64_t nBase2Exponent);
943
944
945#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
946
947
948/* ========================================================================= *
949 * BEGINNING OF DEPRECATED FUNCTION DECLARATIONS *
950 * *
951 * There is no plan to remove these in future versions. *
952 * They just have been replaced by something better. *
953 * ========================================================================= */
954
956static void
957QCBOREncode_AddInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nNum);
958
960static void
961QCBOREncode_AddUInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum);
962
963#ifndef USEFULBUF_DISABLE_ALL_FLOAT
965static void
966QCBOREncode_AddDoubleToMap(QCBOREncodeContext *pCtx, const char *szLabel, double dNum);
967
969static void
970QCBOREncode_AddFloatToMap(QCBOREncodeContext *pCtx, const char *szLabel, float fNum);
971
973static void
974QCBOREncode_AddDoubleNoPreferredToMap(QCBOREncodeContext *pCtx, const char *szLabel, double dNum);
975
977static void
978QCBOREncode_AddFloatNoPreferredToMap(QCBOREncodeContext *pCtx, const char *szLabel, float fNum);
979#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
980
981
983static void
985 uint8_t uTagRequirement,
986 UsefulBufC BigNumber);
987
989static void
991 const char *szLabel,
992 uint8_t uTagRequirement,
993 UsefulBufC BigNumber);
994
996static void
998 int64_t nLabel,
999 uint8_t uTagRequirement,
1000 UsefulBufC BigNumber);
1001
1002
1004static void
1006 UsefulBufC BigNumber);
1007
1009static void
1011 const char *szLabel,
1012 UsefulBufC BigNumber);
1013
1015static void
1017 int64_t nLabel,
1018 UsefulBufC BigNumber);
1019
1020
1022static void
1024 uint8_t uTagRequirement,
1025 UsefulBufC BigNumber);
1026
1028static void
1030 const char *szLabel,
1031 uint8_t uTagRequirement,
1032 UsefulBufC BigNumber);
1033
1035static void
1037 int64_t nLabel,
1038 uint8_t uTagRequirement,
1039 UsefulBufC BigNumber);
1040
1042static void
1044 UsefulBufC BigNumber);
1045
1047static void
1049 const char *szLabel,
1050 UsefulBufC BigNumber);
1051
1053static void
1055 int64_t nLabel,
1056 UsefulBufC BigNumber);
1057
1058
1059#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
1061static void
1063 int64_t nMantissa,
1064 int64_t nBase10Exponent);
1065
1067static void
1069 const char *szLabel,
1070 int64_t nMantissa,
1071 int64_t nBase10Exponent);
1072
1074static void
1076 int64_t nLabel,
1077 int64_t nMantissa,
1078 int64_t nBase10Exponent);
1079
1081static void
1083 uint8_t uTagRequirement,
1084 UsefulBufC Mantissa,
1085 bool bIsNegative,
1086 int64_t nBase10Exponent);
1087
1089static void
1091 const char *szLabel,
1092 uint8_t uTagRequirement,
1093 UsefulBufC Mantissa,
1094 bool bIsNegative,
1095 int64_t nBase10Exponent);
1096
1098static void
1100 int64_t nLabel,
1101 uint8_t uTagRequirement,
1102 UsefulBufC Mantissa,
1103 bool bIsNegative,
1104 int64_t nBase10Exponent);
1105
1107static void
1109 UsefulBufC Mantissa,
1110 bool bIsNegative,
1111 int64_t nBase10Exponent);
1112
1114static void
1116 const char *szLabel,
1117 UsefulBufC Mantissa,
1118 bool bIsNegative,
1119 int64_t nBase10Exponent);
1120
1122static void
1124 int64_t nLabel,
1125 UsefulBufC Mantissa,
1126 bool bIsNegative,
1127 int64_t nBase10Exponent);
1128
1130static void
1132 int64_t nMantissa,
1133 int64_t nBase2Exponent);
1134
1136static void
1138 const char *szLabel,
1139 int64_t nMantissa,
1140 int64_t nBase2Exponent);
1141
1143static void
1145 int64_t nLabel,
1146 int64_t nMantissa,
1147 int64_t nBase2Exponent);
1148
1150static void
1152 uint8_t uTagRequirement,
1153 UsefulBufC Mantissa,
1154 bool bIsNegative,
1155 int64_t nBase2Exponent);
1156
1158static void
1160 const char *szLabel,
1161 uint8_t uTagRequirement,
1162 UsefulBufC Mantissa,
1163 bool bIsNegative,
1164 int64_t nBase2Exponent);
1165
1167static void
1169 int64_t nLabel,
1170 uint8_t uTagRequirement,
1171 UsefulBufC Mantissa,
1172 bool bIsNegative,
1173 int64_t nBase2Exponent);
1174
1176static void
1178 UsefulBufC Mantissa,
1179 bool bIsNegative,
1180 int64_t nBase2Exponent);
1181
1183static void
1185 const char *szLabel,
1186 UsefulBufC Mantissa,
1187 bool bIsNegative,
1188 int64_t nBase2Exponent);
1189
1191static void
1193 int64_t nLabel,
1194 UsefulBufC Mantissa,
1195 bool bIsNegative,
1196 int64_t nBase2Exponent);
1197
1198#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
1199
1200
1201
1202/* ========================================================================= *
1203 * END OF DEPRECATED FUNCTION DECLARATIONS *
1204 * ========================================================================= */
1205
1206
1207
1208
1209
1210/* ========================================================================= *
1211 * BEGINNING OF PRIVATE INLINE IMPLEMENTATION *
1212 * ========================================================================= */
1213
1215void
1216QCBOREncode_Private_AddPreferredDouble(QCBOREncodeContext *pMe, const double dNum);
1217
1218
1220void
1221QCBOREncode_Private_AddPreferredFloat(QCBOREncodeContext *pMe, const float fNum);
1222
1223
1224
1226void
1227QCBOREncode_Private_AddTBigNumberMain(QCBOREncodeContext *pMe,
1228 const uint8_t uTagRequirement,
1229 bool bPreferred,
1230 const bool bNegative,
1231 const UsefulBufC BigNumber);
1232
1234void
1235QCBOREncode_Private_AddTExpIntMantissa(QCBOREncodeContext *pMe,
1236 const int uTagRequirement,
1237 const uint64_t uTagNumber,
1238 const int64_t nExponent,
1239 const int64_t nMantissa);
1240
1241
1243void
1244QCBOREncode_Private_AddTExpBigMantissa(QCBOREncodeContext *pMe,
1245 const int uTagRequirement,
1246 const uint64_t uTagNumber,
1247 const int64_t nExponent,
1248 const UsefulBufC BigNumMantissa,
1249 const bool bBigNumIsNegative);
1250
1251
1253void
1254QCBOREncode_Private_AddTExpBigMantissaRaw(QCBOREncodeContext *pMe,
1255 const int uTagRequirement,
1256 const uint64_t uTagNumber,
1257 const int64_t nExponent,
1258 const UsefulBufC BigNumMantissa,
1259 const bool bBigNumIsNegative);
1260
1261
1262#include "qcbor/qcbor_tag_encode.h"
1263
1264
1265static inline void
1267 const char *szLabel,
1268 const int64_t nNum)
1269{
1270 QCBOREncode_AddSZString(pMe, szLabel);
1271 QCBOREncode_AddInt64(pMe, nNum);
1272}
1273
1274static inline void
1275QCBOREncode_AddInt64ToMap(QCBOREncodeContext *pMe, const char *szLabel, int64_t nNum)
1276{
1277 QCBOREncode_AddInt64ToMapSZ(pMe, szLabel, nNum);
1278}
1279
1280static inline void
1282 const int64_t nLabel,
1283 const int64_t nNum)
1284{
1285 QCBOREncode_AddInt64(pMe, nLabel);
1286 QCBOREncode_AddInt64(pMe, nNum);
1287}
1288
1289
1290static inline void
1291QCBOREncode_AddUInt64(QCBOREncodeContext *pMe, const uint64_t uValue)
1292{
1293 QCBOREncode_Private_AppendCBORHead(pMe, CBOR_MAJOR_TYPE_POSITIVE_INT, uValue, 0);
1294}
1295
1296
1297static inline void
1299 const char *szLabel,
1300 const uint64_t uNum)
1301{
1302 QCBOREncode_AddSZString(pMe, szLabel);
1303 QCBOREncode_AddUInt64(pMe, uNum);
1304}
1305
1306static inline void
1307QCBOREncode_AddUInt64ToMap(QCBOREncodeContext *pMe, const char *szLabel, uint64_t uNum)
1308{
1309 QCBOREncode_AddUInt64ToMapSZ(pMe, szLabel, uNum);
1310}
1311
1312static inline void
1314 const int64_t nLabel,
1315 const uint64_t uNum)
1316{
1317 QCBOREncode_AddInt64(pMe, nLabel);
1318 QCBOREncode_AddUInt64(pMe, uNum);
1319}
1320
1321
1322static inline void
1324{
1325 QCBOREncode_Private_AppendCBORHead(pMe, CBOR_MAJOR_TYPE_NEGATIVE_INT, uValue, 0);
1326}
1327
1328static inline void
1329QCBOREncode_AddNegativeUInt64ToMap(QCBOREncodeContext *pMe, const char *szLabel, uint64_t uNum)
1330{
1331 QCBOREncode_AddSZString(pMe, szLabel);
1333}
1334
1335static inline void
1337{
1338 QCBOREncode_AddInt64(pMe, nLabel);
1340}
1341
1342
1343
1344
1345
1346#ifndef USEFULBUF_DISABLE_ALL_FLOAT
1347
1352static inline void
1353QCBOREncode_Private_AddDoubleRaw(QCBOREncodeContext *pMe, const double dNum)
1354{
1355 QCBOREncode_Private_AddType7(pMe,
1356 sizeof(uint64_t),
1358}
1359
1360static inline void
1362{
1363#ifndef QCBOR_DISABLE_ENCODE_USAGE_GUARDS
1365 pMe->uError = QCBOR_ERR_NOT_PREFERRED;
1366 return;
1367 }
1368#endif /* ! QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
1369
1370 QCBOREncode_Private_AddDoubleRaw(pMe, dNum);
1371}
1372
1373static inline void
1375{
1376#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
1377 QCBOREncode_Private_AddPreferredDouble(pMe, dNum);
1378#else /* ! QCBOR_DISABLE_PREFERRED_FLOAT */
1379 QCBOREncode_Private_AddDoubleRaw(pMe, dNum);
1380#endif /* ! QCBOR_DISABLE_PREFERRED_FLOAT */
1381}
1382
1383static inline void
1385 const char *szLabel,
1386 const double dNum)
1387{
1388 QCBOREncode_AddSZString(pMe, szLabel);
1389 QCBOREncode_AddDouble(pMe, dNum);
1390}
1391
1392static inline void
1393QCBOREncode_AddDoubleToMap(QCBOREncodeContext *pMe, const char *szLabel, double dNum)
1394{
1395 QCBOREncode_AddDoubleToMapSZ(pMe, szLabel, dNum);
1396}
1397
1398static inline void
1400 const int64_t nLabel,
1401 const double dNum)
1402{
1403 QCBOREncode_AddInt64(pMe, nLabel);
1404 QCBOREncode_AddDouble(pMe, dNum);
1405}
1406
1411static inline void
1412QCBOREncode_Private_AddFloatRaw(QCBOREncodeContext *pMe, const float fNum)
1413{
1414 QCBOREncode_Private_AddType7(pMe,
1415 sizeof(uint32_t),
1417}
1418
1419static inline void
1421{
1422#ifndef QCBOR_DISABLE_ENCODE_USAGE_GUARDS
1424 pMe->uError = QCBOR_ERR_NOT_PREFERRED;
1425 return;
1426 }
1427#endif /* ! QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
1428
1429 QCBOREncode_Private_AddFloatRaw(pMe, fNum);
1430}
1431
1432static inline void
1434{
1435#ifndef QCBOR_DISABLE_PREFERRED_FLOAT
1436 QCBOREncode_Private_AddPreferredFloat(pMe, fNum);
1437#else /* ! QCBOR_DISABLE_PREFERRED_FLOAT */
1438 QCBOREncode_Private_AddFloatRaw(pMe, fNum);
1439#endif /* ! QCBOR_DISABLE_PREFERRED_FLOAT */
1440}
1441
1442static inline void
1444 const char *szLabel,
1445 const float dNum)
1446{
1447 QCBOREncode_AddSZString(pMe, szLabel);
1448 QCBOREncode_AddFloat(pMe, dNum);
1449}
1450
1451static inline void
1452QCBOREncode_AddFloatToMap(QCBOREncodeContext *pMe, const char *szLabel, float fNum)
1453{
1454 QCBOREncode_AddFloatToMapSZ(pMe, szLabel, fNum);
1455}
1456
1457static inline void
1459 const int64_t nLabel,
1460 const float fNum)
1461{
1462 QCBOREncode_AddInt64(pMe, nLabel);
1463 QCBOREncode_AddFloat(pMe, fNum);
1464}
1465
1466static inline void
1468 const char *szLabel,
1469 const double dNum)
1470{
1471 QCBOREncode_AddSZString(pMe, szLabel);
1473}
1474
1475static inline void
1476QCBOREncode_AddDoubleNoPreferredToMap(QCBOREncodeContext *pMe, const char *szLabel, double dNum)
1477{
1478 QCBOREncode_AddDoubleNoPreferredToMapSZ(pMe, szLabel, dNum);
1479}
1480
1481static inline void
1483 const int64_t nLabel,
1484 const double dNum)
1485{
1486 QCBOREncode_AddInt64(pMe, nLabel);
1488}
1489
1490static inline void
1492 const char *szLabel,
1493 const float dNum)
1494{
1495 QCBOREncode_AddSZString(pMe, szLabel);
1497}
1498
1499static inline void
1500QCBOREncode_AddFloatNoPreferredToMap(QCBOREncodeContext *pMe, const char *szLabel, float fNum)
1501{
1502 QCBOREncode_AddFloatNoPreferredToMapSZ(pMe, szLabel, fNum);
1503}
1504
1505static inline void
1507 const int64_t nLabel,
1508 const float dNum)
1509{
1510 QCBOREncode_AddInt64(pMe, nLabel);
1512}
1513#endif /* ! USEFULBUF_DISABLE_ALL_FLOAT */
1514
1515
1516
1517
1518static inline void
1520 const uint8_t uTagRequirement,
1521 const bool bNegative,
1522 const UsefulBufC BigNumber)
1523{
1524 QCBOREncode_Private_AddTBigNumberMain(pMe, uTagRequirement, true, bNegative, BigNumber);
1525}
1526
1527
1528static inline void
1530 const char *szLabel,
1531 uint8_t uTagRequirement,
1532 bool bNegative,
1533 UsefulBufC BigNumber)
1534{
1535 QCBOREncode_AddSZString(pMe, szLabel);
1536 QCBOREncode_AddTBigNumber(pMe, uTagRequirement, bNegative, BigNumber);
1537}
1538
1539static inline void
1541 int64_t nLabel,
1542 uint8_t uTagRequirement,
1543 bool bNegative,
1544 UsefulBufC BigNumber)
1545{
1546 QCBOREncode_AddInt64(pMe, nLabel);
1547 QCBOREncode_AddTBigNumber(pMe, uTagRequirement, bNegative, BigNumber);
1548}
1549
1550static inline void
1552 const uint8_t uTagRequirement,
1553 const bool bNegative,
1554 const UsefulBufC BigNumber)
1555{
1556 QCBOREncode_Private_AddTBigNumberMain(pMe, uTagRequirement, false, bNegative, BigNumber);
1557}
1558
1559static inline void
1561 const char *szLabel,
1562 uint8_t uTagRequirement,
1563 bool bNegative,
1564 UsefulBufC BigNumber)
1565{
1566 QCBOREncode_AddSZString(pMe, szLabel);
1567 QCBOREncode_AddTBigNumberNoPreferred(pMe, uTagRequirement, bNegative, BigNumber);
1568}
1569
1570static inline void
1572 int64_t nLabel,
1573 uint8_t uTagRequirement,
1574 bool bNegative,
1575 UsefulBufC BigNumber)
1576{
1577 QCBOREncode_AddInt64(pMe, nLabel);
1578 QCBOREncode_AddTBigNumberNoPreferred(pMe, uTagRequirement, bNegative, BigNumber);
1579}
1580
1589static inline void
1590QCBOREncode_Private_BigNumberTag(QCBOREncodeContext *pMe,
1591 const uint8_t uTagRequirement,
1592 bool bNegative)
1593{
1594 if(uTagRequirement == QCBOR_ENCODE_AS_TAG) {
1596 }
1597}
1598
1599
1600static inline void
1602 const uint8_t uTagRequirement,
1603 bool bNegative,
1604 const UsefulBufC BigNumber)
1605{
1606#ifndef QCBOR_DISABLE_ENCODE_USAGE_GUARDS
1607 if(pMe->uConfigFlags & QCBOR_ENCODE_CONFIG_ONLY_PREFERRED_BIG_NUMBERS) {
1608 pMe->uError = QCBOR_ERR_NOT_PREFERRED;
1609 return;
1610 }
1611#endif /* ! QCBOR_DISABLE_ENCODE_USAGE_GUARDS */
1612
1613 QCBOREncode_Private_BigNumberTag(pMe, uTagRequirement, bNegative);
1614 QCBOREncode_AddBytes(pMe, BigNumber);
1615}
1616
1617static inline void
1619 const char *szLabel,
1620 const uint8_t uTagRequirement,
1621 bool bNegative,
1622 const UsefulBufC BigNumber)
1623{
1624 QCBOREncode_AddSZString(pMe, szLabel);
1625 QCBOREncode_AddTBigNumberRaw(pMe, uTagRequirement, bNegative, BigNumber);
1626}
1627
1628
1629static inline void
1631 int64_t nLabel,
1632 const uint8_t uTagRequirement,
1633 bool bNegative,
1634 const UsefulBufC BigNumber)
1635{
1636 QCBOREncode_AddInt64(pMe, nLabel);
1637 QCBOREncode_AddTBigNumberRaw(pMe, uTagRequirement, bNegative, BigNumber);
1638}
1639
1640
1641
1642
1643
1644#ifndef QCBOR_DISABLE_EXP_AND_MANTISSA
1645
1646static inline void
1648 const uint8_t uTagRequirement,
1649 const int64_t nMantissa,
1650 const int64_t nBase10Exponent)
1651{
1652 QCBOREncode_Private_AddTExpIntMantissa(pMe,
1653 uTagRequirement,
1655 nBase10Exponent,
1656 nMantissa);
1657}
1658
1659static inline void
1661 const char *szLabel,
1662 const uint8_t uTagRequirement,
1663 const int64_t nMantissa,
1664 const int64_t nBase10Exponent)
1665{
1666 QCBOREncode_AddSZString(pMe, szLabel);
1668 uTagRequirement,
1669 nMantissa,
1670 nBase10Exponent);
1671}
1672
1673static inline void
1675 const int64_t nLabel,
1676 const uint8_t uTagRequirement,
1677 const int64_t nMantissa,
1678 const int64_t nBase10Exponent)
1679{
1680 QCBOREncode_AddInt64(pMe, nLabel);
1682 uTagRequirement,
1683 nMantissa,
1684 nBase10Exponent);
1685}
1686
1687
1688
1689static inline void
1691 const uint8_t uTagRequirement,
1692 const UsefulBufC Mantissa,
1693 const bool bIsNegative,
1694 const int64_t nBase10Exponent)
1695{
1696 QCBOREncode_Private_AddTExpBigMantissa(pMe,
1697 uTagRequirement,
1699 nBase10Exponent,
1700 Mantissa,
1701 bIsNegative);
1702}
1703
1704
1705static inline void
1707 const char *szLabel,
1708 const uint8_t uTagRequirement,
1709 const UsefulBufC Mantissa,
1710 const bool bIsNegative,
1711 const int64_t nBase10Exponent)
1712{
1713 QCBOREncode_AddSZString(pMe, szLabel);
1715 uTagRequirement,
1716 Mantissa,
1717 bIsNegative,
1718 nBase10Exponent);
1719}
1720
1721static inline void
1723 const int64_t nLabel,
1724 const uint8_t uTagRequirement,
1725 const UsefulBufC Mantissa,
1726 const bool bIsNegative,
1727 const int64_t nBase10Exponent)
1728{
1729 QCBOREncode_AddInt64(pMe, nLabel);
1731 uTagRequirement,
1732 Mantissa,
1733 bIsNegative,
1734 nBase10Exponent);
1735}
1736
1737static inline void
1739 const uint8_t uTagRequirement,
1740 const UsefulBufC Mantissa,
1741 const bool bIsNegative,
1742 const int64_t nBase10Exponent)
1743{
1744 QCBOREncode_Private_AddTExpBigMantissaRaw(pMe,
1745 uTagRequirement,
1747 nBase10Exponent,
1748 Mantissa,
1749 bIsNegative);
1750}
1751
1752
1753static inline void
1755 const char *szLabel,
1756 const uint8_t uTagRequirement,
1757 const UsefulBufC Mantissa,
1758 const bool bIsNegative,
1759 const int64_t nBase10Exponent)
1760{
1761 QCBOREncode_AddSZString(pMe, szLabel);
1763 uTagRequirement,
1764 Mantissa,
1765 bIsNegative,
1766 nBase10Exponent);
1767}
1768
1769static inline void
1771 const int64_t nLabel,
1772 const uint8_t uTagRequirement,
1773 const UsefulBufC Mantissa,
1774 const bool bIsNegative,
1775 const int64_t nBase10Exponent)
1776{
1777 QCBOREncode_AddInt64(pMe, nLabel);
1779 uTagRequirement,
1780 Mantissa,
1781 bIsNegative,
1782 nBase10Exponent);
1783}
1784
1785
1786static inline void
1788 const uint8_t uTagRequirement,
1789 const int64_t nMantissa,
1790 const int64_t nBase2Exponent)
1791{
1792 QCBOREncode_Private_AddTExpIntMantissa(pMe,
1793 uTagRequirement,
1795 nBase2Exponent,
1796 nMantissa);
1797}
1798
1799static inline void
1801 const char *szLabel,
1802 const uint8_t uTagRequirement,
1803 const int64_t nMantissa,
1804 const int64_t nBase2Exponent)
1805{
1806 QCBOREncode_AddSZString(pMe, szLabel);
1807 QCBOREncode_AddTBigFloat(pMe, uTagRequirement, nMantissa, nBase2Exponent);
1808}
1809
1810static inline void
1812 const int64_t nLabel,
1813 const uint8_t uTagRequirement,
1814 const int64_t nMantissa,
1815 const int64_t nBase2Exponent)
1816{
1817 QCBOREncode_AddInt64(pMe, nLabel);
1818 QCBOREncode_AddTBigFloat(pMe, uTagRequirement, nMantissa, nBase2Exponent);
1819}
1820
1821
1822static inline void
1824 const uint8_t uTagRequirement,
1825 const UsefulBufC Mantissa,
1826 const bool bIsNegative,
1827 const int64_t nBase2Exponent)
1828{
1829 QCBOREncode_Private_AddTExpBigMantissa(pMe,
1830 uTagRequirement,
1832 nBase2Exponent,
1833 Mantissa,
1834 bIsNegative);
1835}
1836
1837static inline void
1839 const char *szLabel,
1840 const uint8_t uTagRequirement,
1841 const UsefulBufC Mantissa,
1842 const bool bIsNegative,
1843 const int64_t nBase2Exponent)
1844{
1845 QCBOREncode_AddSZString(pMe, szLabel);
1847 uTagRequirement,
1848 Mantissa,
1849 bIsNegative,
1850 nBase2Exponent);
1851}
1852
1853static inline void
1855 const int64_t nLabel,
1856 const uint8_t uTagRequirement,
1857 const UsefulBufC Mantissa,
1858 const bool bIsNegative,
1859 const int64_t nBase2Exponent)
1860{
1861 QCBOREncode_AddInt64(pMe, nLabel);
1863 uTagRequirement,
1864 Mantissa,
1865 bIsNegative,
1866 nBase2Exponent);
1867}
1868
1869
1870static inline void
1872 const uint8_t uTagRequirement,
1873 const UsefulBufC Mantissa,
1874 const bool bIsNegative,
1875 const int64_t nBase2Exponent)
1876{
1877 QCBOREncode_Private_AddTExpBigMantissaRaw(pMe,
1878 uTagRequirement,
1880 nBase2Exponent,
1881 Mantissa,
1882 bIsNegative);
1883}
1884
1885static inline void
1887 const char *szLabel,
1888 const uint8_t uTagRequirement,
1889 const UsefulBufC Mantissa,
1890 const bool bIsNegative,
1891 const int64_t nBase2Exponent)
1892{
1893 QCBOREncode_AddSZString(pMe, szLabel);
1895 uTagRequirement,
1896 Mantissa,
1897 bIsNegative,
1898 nBase2Exponent);
1899}
1900
1901static inline void
1903 const int64_t nLabel,
1904 const uint8_t uTagRequirement,
1905 const UsefulBufC Mantissa,
1906 const bool bIsNegative,
1907 const int64_t nBase2Exponent)
1908{
1909 QCBOREncode_AddInt64(pMe, nLabel);
1911 uTagRequirement,
1912 Mantissa,
1913 bIsNegative,
1914 nBase2Exponent);
1915}
1916
1917#endif /* ! QCBOR_DISABLE_EXP_AND_MANTISSA */
1918
1919
1920
1921/* ======================================================================== *
1922 * END OF PRIVATE INLINE IMPLEMENTATION *
1923 * ======================================================================== */
1924
1925
1926
1927
1928/* ========================================================================= *
1929 * BEGINNING OF INLINES FOR DEPRECATED FUNCTIONS *
1930 * ========================================================================= */
1931
1932
1933static inline void /* Deprecated */
1935 const uint8_t uTagRequirement,
1936 const UsefulBufC BigNumber)
1937{
1938 QCBOREncode_AddTBigNumberRaw(pMe, uTagRequirement, false, BigNumber);
1939}
1940
1941static inline void /* Deprecated */
1943 const char *szLabel,
1944 const uint8_t uTagRequirement,
1945 const UsefulBufC BigNumber)
1946{
1947 QCBOREncode_AddTBigNumberRawToMapSZ(pMe, szLabel, uTagRequirement, false, BigNumber);
1948}
1949
1950static inline void /* Deprecated */
1952 const int64_t nLabel,
1953 const uint8_t uTagRequirement,
1954 const UsefulBufC BigNumber)
1955{
1956 QCBOREncode_AddTBigNumberRawToMapN(pMe, nLabel, uTagRequirement, false, BigNumber);
1957}
1958
1959static inline void /* Deprecated */
1964
1965static inline void /* Deprecated */
1967 const char *szLabel,
1968 const UsefulBufC BigNumber)
1969{
1970 QCBOREncode_AddTBigNumberRawToMapSZ(pMe, szLabel, QCBOR_ENCODE_AS_TAG, false, BigNumber);
1971}
1972
1973static inline void /* Deprecated */
1975 const int64_t nLabel,
1976 const UsefulBufC BigNumber)
1977{
1978 QCBOREncode_AddTBigNumberRawToMapN(pMe, nLabel, QCBOR_ENCODE_AS_TAG, false, BigNumber);
1979}
1980
1981static inline void /* Deprecated */
1983 const uint8_t uTagRequirement,
1984 const UsefulBufC BigNumber)
1985{
1986 QCBOREncode_AddTBigNumberRaw(pMe, uTagRequirement, true, BigNumber);
1987}
1988
1989static inline void /* Deprecated */
1991 const char *szLabel,
1992 const uint8_t uTagRequirement,
1993 const UsefulBufC BigNumber)
1994{
1996 szLabel,
1997 uTagRequirement,
1998 true,
1999 BigNumber);
2000}
2001
2002static inline void /* Deprecated */
2004 const int64_t nLabel,
2005 const uint8_t uTagRequirement,
2006 const UsefulBufC BigNumber)
2007{
2009 nLabel,
2010 uTagRequirement,
2011 true,
2012 BigNumber);
2013}
2014
2015static inline void /* Deprecated */
2020
2021static inline void /* Deprecated */
2023 const char *szLabel,
2024 const UsefulBufC BigNumber)
2025{
2026 QCBOREncode_AddTBigNumberRawToMapSZ(pMe, szLabel, QCBOR_ENCODE_AS_TAG, true, BigNumber);
2027}
2028
2029static inline void /* Deprecated */
2031 const int64_t nLabel,
2032 const UsefulBufC BigNumber)
2033{
2034 QCBOREncode_AddTBigNumberRawToMapN(pMe, nLabel, QCBOR_ENCODE_AS_TAG, true, BigNumber);
2035
2036}
2037
2038#ifndef QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA
2039static inline void /* Deprecated */
2041 const int64_t nMantissa,
2042 const int64_t nBase10Exponent)
2043{
2046 nMantissa,
2047 nBase10Exponent);
2048}
2049
2050static inline void /* Deprecated */
2052 const char *szLabel,
2053 const int64_t nMantissa,
2054 const int64_t nBase10Exponent)
2055{
2057 szLabel,
2059 nMantissa,
2060 nBase10Exponent);
2061}
2062
2063static inline void /* Deprecated */
2065 const int64_t nLabel,
2066 const int64_t nMantissa,
2067 const int64_t nBase10Exponent)
2068{
2070 nLabel,
2072 nMantissa,
2073 nBase10Exponent);
2074}
2075
2076
2077static inline void /* Deprecated */
2079 const uint8_t uTagRequirement,
2080 const UsefulBufC Mantissa,
2081 const bool bIsNegative,
2082 const int64_t nBase10Exponent)
2083{
2085 uTagRequirement,
2086 Mantissa,
2087 bIsNegative,
2088 nBase10Exponent);
2089}
2090
2091
2092static inline void /* Deprecated */
2094 const char *szLabel,
2095 const uint8_t uTagRequirement,
2096 const UsefulBufC Mantissa,
2097 const bool bIsNegative,
2098 const int64_t nBase10Exponent)
2099{
2101 szLabel,
2102 uTagRequirement,
2103 Mantissa,
2104 bIsNegative,
2105 nBase10Exponent);
2106}
2107
2108static inline void /* Deprecated */
2110 const int64_t nLabel,
2111 const uint8_t uTagRequirement,
2112 const UsefulBufC Mantissa,
2113 const bool bIsNegative,
2114 const int64_t nBase10Exponent)
2115{
2117 nLabel,
2118 uTagRequirement,
2119 Mantissa,
2120 bIsNegative,
2121 nBase10Exponent);
2122}
2123
2124static inline void /* Deprecated */
2126 const UsefulBufC Mantissa,
2127 const bool bIsNegative,
2128 const int64_t nBase10Exponent)
2129{
2132 Mantissa,
2133 bIsNegative,
2134 nBase10Exponent);
2135}
2136
2137static inline void /* Deprecated */
2139 const char *szLabel,
2140 const UsefulBufC Mantissa,
2141 const bool bIsNegative,
2142 const int64_t nBase10Exponent)
2143{
2145 szLabel,
2147 Mantissa,
2148 bIsNegative,
2149 nBase10Exponent);
2150}
2151
2152static inline void /* Deprecated */
2154 const int64_t nLabel,
2155 const UsefulBufC Mantissa,
2156 const bool bIsNegative,
2157 const int64_t nBase10Exponent)
2158{
2160 nLabel,
2162 Mantissa,
2163 bIsNegative,
2164 nBase10Exponent);
2165}
2166
2167
2168static inline void /* Deprecated */
2170 const int64_t nMantissa,
2171 const int64_t nBase2Exponent)
2172{
2175 nMantissa,
2176 nBase2Exponent);
2177}
2178
2179static inline void /* Deprecated */
2181 const char *szLabel,
2182 const int64_t nMantissa,
2183 const int64_t nBase2Exponent)
2184{
2186 szLabel,
2188 nMantissa,
2189 nBase2Exponent);
2190}
2191
2192static inline void /* Deprecated */
2194 const int64_t nLabel,
2195 const int64_t nMantissa,
2196 const int64_t nBase2Exponent)
2197{
2199 nLabel,
2201 nMantissa,
2202 nBase2Exponent);
2203}
2204
2205static inline void /* Deprecated */
2207 const uint8_t uTagRequirement,
2208 const UsefulBufC Mantissa,
2209 const bool bIsNegative,
2210 const int64_t nBase2Exponent)
2211{
2213 uTagRequirement,
2214 Mantissa,
2215 bIsNegative,
2216 nBase2Exponent);
2217}
2218
2219static inline void /* Deprecated */
2221 const char *szLabel,
2222 const uint8_t uTagRequirement,
2223 const UsefulBufC Mantissa,
2224 const bool bIsNegative,
2225 const int64_t nBase2Exponent)
2226{
2228 szLabel,
2229 uTagRequirement,
2230 Mantissa,
2231 bIsNegative,
2232 nBase2Exponent);
2233}
2234
2235static inline void /* Deprecated */
2237 const int64_t nLabel,
2238 const uint8_t uTagRequirement,
2239 const UsefulBufC Mantissa,
2240 const bool bIsNegative,
2241 const int64_t nBase2Exponent)
2242{
2244 nLabel,
2245 uTagRequirement,
2246 Mantissa,
2247 bIsNegative,
2248 nBase2Exponent);
2249}
2250
2251
2252static inline void /* Deprecated */
2254 const UsefulBufC Mantissa,
2255 const bool bIsNegative,
2256 const int64_t nBase2Exponent)
2257{
2260 Mantissa,
2261 bIsNegative,
2262 nBase2Exponent);
2263}
2264
2265static inline void /* Deprecated */
2267 const char *szLabel,
2268 const UsefulBufC Mantissa,
2269 const bool bIsNegative,
2270 const int64_t nBase2Exponent)
2271{
2273 szLabel,
2275 Mantissa,
2276 bIsNegative,
2277 nBase2Exponent);
2278}
2279
2280static inline void /* Deprecated */
2282 const int64_t nLabel,
2283 const UsefulBufC Mantissa,
2284 const bool bIsNegative,
2285 const int64_t nBase2Exponent)
2286{
2288 nLabel,
2290 Mantissa,
2291 bIsNegative,
2292 nBase2Exponent);
2293}
2294
2295#endif /* ! QCBOR_CONFIG_DISABLE_EXP_AND_MANTISSA */
2296
2297/* ========================================================================= *
2298 * END OF INLINES FOR DEPRECATED FUNCTIONS *
2299 * ========================================================================= */
2300
2301
2302#ifdef __cplusplus
2303}
2304#endif
2305
2306#endif /* qcbor_number_encode_h */
static uint32_t UsefulBufUtil_CopyFloatToUint32(float f)
Copy a float to a uint32_t.
Definition UsefulBuf.h:2099
static uint64_t UsefulBufUtil_CopyDoubleToUint64(double d)
Copy a double to a uint64_t.
Definition UsefulBuf.h:2106
#define CBOR_TAG_POS_BIGNUM
Definition qcbor_common.h:129
#define CBOR_TAG_BIGFLOAT
Definition qcbor_common.h:140
#define CBOR_TAG_DECIMAL_FRACTION
Definition qcbor_common.h:136
@ QCBOR_ERR_NOT_PREFERRED
Definition qcbor_common.h:554
#define CBOR_TAG_NEG_BIGNUM
Definition qcbor_common.h:132
struct _QCBOREncodeContext QCBOREncodeContext
Definition qcbor_main_encode.h:311
@ QCBOR_ENCODE_CONFIG_DISALLOW_NON_PREFERRED_NUMBERS
Definition qcbor_main_encode.h:198
@ QCBOR_ENCODE_CONFIG_ONLY_PREFERRED_BIG_NUMBERS
Definition qcbor_main_encode.h:212
static void QCBOREncode_AddSZString(QCBOREncodeContext *pCtx, const char *szString)
Add a UTF-8 text string to the encoded output.
Definition qcbor_main_encode.h:1508
static void QCBOREncode_AddTBigNumberRawToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1630
static void QCBOREncode_AddTPositiveBignumToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1942
static void QCBOREncode_AddUInt64ToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum)
Definition qcbor_number_encode.h:1298
static void QCBOREncode_AddFloatNoPreferredToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, float fNum)
Definition qcbor_number_encode.h:1491
static void QCBOREncode_AddDoubleNoPreferred(QCBOREncodeContext *pCtx, double dNum)
Add a double-precision floating-point number without preferred encoding.
Definition qcbor_number_encode.h:1361
static void QCBOREncode_AddTDecimalFractionBigMantissaRaw(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Add a decimal fraction with a raw big number mantissa.
Definition qcbor_number_encode.h:1738
static void QCBOREncode_AddTBigNumberNoPreferredToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1571
static void QCBOREncode_AddDecimalFractionBigNumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2153
static void QCBOREncode_AddFloatToMap(QCBOREncodeContext *pCtx, const char *szLabel, float fNum)
Definition qcbor_number_encode.h:1452
static void QCBOREncode_AddFloatToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, float fNum)
Definition qcbor_number_encode.h:1443
static void QCBOREncode_AddTBigFloatBigNum(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2206
static void QCBOREncode_AddTNegativeBignum(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1982
static void QCBOREncode_AddTDecimalFractionBigMantissa(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Add a decimal fraction with a big number mantissa..
Definition qcbor_number_encode.h:1690
static void QCBOREncode_AddTDecimalFractionBigNumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2109
static void QCBOREncode_AddFloatToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, float dNum)
Definition qcbor_number_encode.h:1458
static void QCBOREncode_AddTDecimalFractionBigNum(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2078
static void QCBOREncode_AddTBigNumberToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1540
static void QCBOREncode_AddNegativeBignumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:2030
static void QCBOREncode_AddTNegativeBignumToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1990
static void QCBOREncode_AddNegativeUInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint64_t uNum)
Definition qcbor_number_encode.h:1336
static void QCBOREncode_AddBytesToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC Bytes)
static void QCBOREncode_AddUInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum)
Definition qcbor_number_encode.h:1307
static void QCBOREncode_AddDecimalFraction(QCBOREncodeContext *pCtx, int64_t nMantissa, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2040
static void QCBOREncode_OpenBytesInMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBuf *pPlace)
static void QCBOREncode_AddBigFloatBigNum(QCBOREncodeContext *pCtx, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2253
static void QCBOREncode_AddTBigNumberToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1529
static void QCBOREncode_AddTBigFloatBigMantissaToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1854
static void QCBOREncode_AddTDecimalFractionBigMantissaToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1722
void QCBOREncode_CloseBytes(QCBOREncodeContext *pCtx, size_t uAmount)
Close out a byte string written directly to encoded output.
static void QCBOREncode_AddTPositiveBignum(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1934
static void QCBOREncode_AddDoubleNoPreferredToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, double dNum)
Definition qcbor_number_encode.h:1482
static void QCBOREncode_AddTDecimalFraction(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase10Exponent)
Add a decimal fraction.
Definition qcbor_number_encode.h:1647
static void QCBOREncode_AddTBigFloatBigMantissaRawToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1886
static void QCBOREncode_AddDoubleToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, double dNum)
Definition qcbor_number_encode.h:1399
static void QCBOREncode_AddFloatNoPreferredToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, float fNum)
Definition qcbor_number_encode.h:1506
static void QCBOREncode_OpenBytesInMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBuf *pPlace)
static void QCBOREncode_AddTBigNumberRawToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1618
static void QCBOREncode_AddNegativeUInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, uint64_t uNum)
Definition qcbor_number_encode.h:1329
static void QCBOREncode_AddDoubleToMap(QCBOREncodeContext *pCtx, const char *szLabel, double dNum)
Definition qcbor_number_encode.h:1393
static void QCBOREncode_AddTBigFloat(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase2Exponent)
Add a big floating-point number to the encoded output.
Definition qcbor_number_encode.h:1787
static void QCBOREncode_AddDecimalFractionToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, int64_t nMantissa, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2064
static void QCBOREncode_AddDoubleNoPreferredToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, double dNum)
Definition qcbor_number_encode.h:1467
static void QCBOREncode_AddFloatNoPreferred(QCBOREncodeContext *pCtx, float fNum)
Add a single-precision floating-point number without preferred encoding.
Definition qcbor_number_encode.h:1420
static void QCBOREncode_AddBigFloatBigNumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2281
static void QCBOREncode_AddTDecimalFractionBigMantissaRawToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1754
static void QCBOREncode_AddNegativeBignum(QCBOREncodeContext *pCtx, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:2016
static void QCBOREncode_AddTDecimalFractionBigMantissaToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1706
void QCBOREncode_AddInt64(QCBOREncodeContext *pCtx, int64_t nNum)
Add a signed 64-bit integer to the encoded output.
static void QCBOREncode_AddTDecimalFractionToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1660
static void QCBOREncode_AddUInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint64_t uNum)
Definition qcbor_number_encode.h:1313
static void QCBOREncode_AddInt64ToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nNum)
Definition qcbor_number_encode.h:1266
static void QCBOREncode_AddDoubleNoPreferredToMap(QCBOREncodeContext *pCtx, const char *szLabel, double dNum)
Definition qcbor_number_encode.h:1476
static void QCBOREncode_AddBytes(QCBOREncodeContext *pCtx, UsefulBufC Bytes)
Add a byte string to the encoded output.
static void QCBOREncode_AddDecimalFractionBigNumToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2138
static void QCBOREncode_AddTNegativeBignumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:2003
static void QCBOREncode_AddTBigFloatToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1811
static void QCBOREncode_AddTBigNumber(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Add a big number to encoded output using preferred serialization.
Definition qcbor_number_encode.h:1519
static void QCBOREncode_AddTBigNumberNoPreferredToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1560
static void QCBOREncode_AddPositiveBignum(QCBOREncodeContext *pCtx, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1960
static void QCBOREncode_AddTBigFloatBigNumToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2220
static void QCBOREncode_AddTBigFloatBigMantissaToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1838
static void QCBOREncode_AddFloatNoPreferredToMap(QCBOREncodeContext *pCtx, const char *szLabel, float fNum)
Definition qcbor_number_encode.h:1500
static void QCBOREncode_AddDecimalFractionBigNum(QCBOREncodeContext *pCtx, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2125
static void QCBOREncode_AddTBigNumberNoPreferred(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Add a big number to encoded output without preferred serialization.
Definition qcbor_number_encode.h:1551
static void QCBOREncode_AddTBigFloatToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1800
static void QCBOREncode_AddFloat(QCBOREncodeContext *pCtx, float fNum)
Add a single-precision floating-point number to the encoded output.
Definition qcbor_number_encode.h:1433
static void QCBOREncode_AddInt64ToMap(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nNum)
Definition qcbor_number_encode.h:1275
static void QCBOREncode_AddDouble(QCBOREncodeContext *pCtx, double dNum)
Add a double-precision floating-point number to the encoded output.
Definition qcbor_number_encode.h:1374
static void QCBOREncode_AddTPositiveBignumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1951
static void QCBOREncode_AddTBigNumberRaw(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, bool bNegative, UsefulBufC BigNumber)
Add a big number to encoded output with no processing.
Definition qcbor_number_encode.h:1601
void QCBOREncode_OpenBytes(QCBOREncodeContext *pCtx, UsefulBuf *pPlace)
Set up to write a byte string value directly to encoded output.
static void QCBOREncode_AddTBigFloatBigMantissaRawToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:1902
static void QCBOREncode_AddBigFloat(QCBOREncodeContext *pCtx, int64_t nMantissa, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2169
static void QCBOREncode_AddBigFloatToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, int64_t nMantissa, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2193
static void QCBOREncode_AddTDecimalFractionToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, int64_t nMantissa, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1674
static void QCBOREncode_AddBytesToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC Bytes)
static void QCBOREncode_AddNegativeBignumToMap(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:2022
static void QCBOREncode_AddUInt64(QCBOREncodeContext *pCtx, uint64_t uNum)
Add an unsigned 64-bit integer to the encoded output.
Definition qcbor_number_encode.h:1291
static void QCBOREncode_AddDoubleToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, double dNum)
Definition qcbor_number_encode.h:1384
static void QCBOREncode_AddDecimalFractionToMap(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nMantissa, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2051
static void QCBOREncode_AddTBigFloatBigNumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2236
static void QCBOREncode_AddTDecimalFractionBigNumToMapSZ(QCBOREncodeContext *pCtx, const char *szLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:2093
static void QCBOREncode_AddBigFloatToMap(QCBOREncodeContext *pCtx, const char *szLabel, int64_t nMantissa, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2180
static void QCBOREncode_AddNegativeUInt64(QCBOREncodeContext *pCtx, uint64_t uNum)
Add a negative 64-bit integer to encoded output.
Definition qcbor_number_encode.h:1323
static void QCBOREncode_AddInt64ToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, int64_t nNum)
Definition qcbor_number_encode.h:1281
static void QCBOREncode_AddTDecimalFractionBigMantissaRawToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase10Exponent)
Definition qcbor_number_encode.h:1770
static void QCBOREncode_AddTBigFloatBigMantissa(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Add a big floating-point number with a big number mantissa.
Definition qcbor_number_encode.h:1823
static void QCBOREncode_AddPositiveBignumToMap(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1966
static void QCBOREncode_AddBigFloatBigNumToMap(QCBOREncodeContext *pCtx, const char *szLabel, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Definition qcbor_number_encode.h:2266
static void QCBOREncode_AddTBigFloatBigMantissaRaw(QCBOREncodeContext *pCtx, uint8_t uTagRequirement, UsefulBufC Mantissa, bool bIsNegative, int64_t nBase2Exponent)
Add a big floating-point number with a big number mantissa.
Definition qcbor_number_encode.h:1871
static void QCBOREncode_AddPositiveBignumToMapN(QCBOREncodeContext *pCtx, int64_t nLabel, UsefulBufC BigNumber)
Definition qcbor_number_encode.h:1974
@ QCBOR_ENCODE_AS_TAG
Definition qcbor_tag_encode.h:121
static void QCBOREncode_AddTagNumber(QCBOREncodeContext *pCtx, uint64_t uTagNumber)
Add a tag number.
Definition qcbor_tag_encode.h:709
Definition UsefulBuf.h:280
Definition UsefulBuf.h:291