@@ -1229,6 +1229,49 @@ template <> inline uint32_t EncodingContext::computeSize(const Uuid&) const {
1229
1229
return 2 * sizeof (uint64_t );
1230
1230
}
1231
1231
1232
+ // Specializations for primitive types that don't have compact encoding
1233
+ // These must be declared before the generic template
1234
+
1235
+ /* *
1236
+ * Template overload for int8_t.
1237
+ * This data type is not compacted, so we just point to non-compact implementation.
1238
+ */
1239
+ template <> inline uint32_t EncodingContext::computeCompactSize (const int8_t & arg) const {
1240
+ return computeSize (arg);
1241
+ }
1242
+
1243
+ /* *
1244
+ * Template overload for int16_t.
1245
+ * This data type is not compacted, so we just point to non-compact implementation.
1246
+ */
1247
+ template <> inline uint32_t EncodingContext::computeCompactSize (const int16_t & arg) const {
1248
+ return computeSize (arg);
1249
+ }
1250
+
1251
+ /* *
1252
+ * Template overload for uint16_t.
1253
+ * This data type is not compacted, so we just point to non-compact implementation.
1254
+ */
1255
+ template <> inline uint32_t EncodingContext::computeCompactSize (const uint16_t & arg) const {
1256
+ return computeSize (arg);
1257
+ }
1258
+
1259
+ /* *
1260
+ * Template overload for bool.
1261
+ * This data type is not compacted, so we just point to non-compact implementation.
1262
+ */
1263
+ template <> inline uint32_t EncodingContext::computeCompactSize (const bool & arg) const {
1264
+ return computeSize (arg);
1265
+ }
1266
+
1267
+ /* *
1268
+ * Template overload for double.
1269
+ * This data type is not compacted, so we just point to non-compact implementation.
1270
+ */
1271
+ template <> inline uint32_t EncodingContext::computeCompactSize (const double & arg) const {
1272
+ return computeSize (arg);
1273
+ }
1274
+
1232
1275
/* *
1233
1276
* For non-primitive types, call `computeCompactSize` on them, to delegate the work to the entity
1234
1277
* itself. The entity may use the information in context to decide which fields are included etc.
@@ -1534,6 +1577,45 @@ inline uint32_t EncodingContext::encodeCompact(const int64_t& arg, Buffer::Insta
1534
1577
return encode (arg, dst);
1535
1578
}
1536
1579
1580
+ /* *
1581
+ * int8_t is not encoded in compact fashion, so we just delegate to normal implementation.
1582
+ */
1583
+ template <>
1584
+ inline uint32_t EncodingContext::encodeCompact (const int8_t & arg, Buffer::Instance& dst) {
1585
+ return encode (arg, dst);
1586
+ }
1587
+
1588
+ /* *
1589
+ * int16_t is not encoded in compact fashion, so we just delegate to normal implementation.
1590
+ */
1591
+ template <>
1592
+ inline uint32_t EncodingContext::encodeCompact (const int16_t & arg, Buffer::Instance& dst) {
1593
+ return encode (arg, dst);
1594
+ }
1595
+
1596
+ /* *
1597
+ * uint16_t is not encoded in compact fashion, so we just delegate to normal implementation.
1598
+ */
1599
+ template <>
1600
+ inline uint32_t EncodingContext::encodeCompact (const uint16_t & arg, Buffer::Instance& dst) {
1601
+ return encode (arg, dst);
1602
+ }
1603
+
1604
+ /* *
1605
+ * bool is not encoded in compact fashion, so we just delegate to normal implementation.
1606
+ */
1607
+ template <> inline uint32_t EncodingContext::encodeCompact (const bool & arg, Buffer::Instance& dst) {
1608
+ return encode (arg, dst);
1609
+ }
1610
+
1611
+ /* *
1612
+ * double is not encoded in compact fashion, so we just delegate to normal implementation.
1613
+ */
1614
+ template <>
1615
+ inline uint32_t EncodingContext::encodeCompact (const double & arg, Buffer::Instance& dst) {
1616
+ return encode (arg, dst);
1617
+ }
1618
+
1537
1619
/* *
1538
1620
* Template overload for variable-length uint32_t (VAR_UINT).
1539
1621
* Encode the value in 7-bit chunks + marker if field is the last one.
0 commit comments