|
|
|||
File indexing completed on 2026-05-10 08:43:22
0001 //===-- MsgPack.h - MessagePack Constants -----------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 /// 0009 /// \file 0010 /// This file contains constants used for implementing MessagePack support. 0011 /// 0012 //===----------------------------------------------------------------------===// 0013 0014 #ifndef LLVM_BINARYFORMAT_MSGPACK_H 0015 #define LLVM_BINARYFORMAT_MSGPACK_H 0016 0017 #include "llvm/Support/DataTypes.h" 0018 #include "llvm/Support/Endian.h" 0019 0020 namespace llvm { 0021 namespace msgpack { 0022 0023 /// The endianness of all multi-byte encoded values in MessagePack. 0024 constexpr llvm::endianness Endianness = llvm::endianness::big; 0025 0026 /// The first byte identifiers of MessagePack object formats. 0027 namespace FirstByte { 0028 #define HANDLE_MP_FIRST_BYTE(ID, NAME) constexpr uint8_t NAME = ID; 0029 #include "llvm/BinaryFormat/MsgPack.def" 0030 } 0031 0032 /// Most significant bits used to identify "Fix" variants in MessagePack. 0033 /// 0034 /// For example, FixStr objects encode their size in the five least significant 0035 /// bits of their first byte, which is identified by the bit pattern "101" in 0036 /// the three most significant bits. So FixBits::String contains 0b10100000. 0037 /// 0038 /// A corresponding mask of the bit pattern is found in \c FixBitsMask. 0039 namespace FixBits { 0040 #define HANDLE_MP_FIX_BITS(ID, NAME) constexpr uint8_t NAME = ID; 0041 #include "llvm/BinaryFormat/MsgPack.def" 0042 } 0043 0044 /// Mask of bits used to identify "Fix" variants in MessagePack. 0045 /// 0046 /// For example, FixStr objects encode their size in the five least significant 0047 /// bits of their first byte, which is identified by the bit pattern "101" in 0048 /// the three most significant bits. So FixBitsMask::String contains 0049 /// 0b11100000. 0050 /// 0051 /// The corresponding bit pattern to mask for is found in FixBits. 0052 namespace FixBitsMask { 0053 #define HANDLE_MP_FIX_BITS_MASK(ID, NAME) constexpr uint8_t NAME = ID; 0054 #include "llvm/BinaryFormat/MsgPack.def" 0055 } 0056 0057 /// The maximum value or size encodable in "Fix" variants of formats. 0058 /// 0059 /// For example, FixStr objects encode their size in the five least significant 0060 /// bits of their first byte, so the largest encodable size is 0b00011111. 0061 namespace FixMax { 0062 #define HANDLE_MP_FIX_MAX(ID, NAME) constexpr uint8_t NAME = ID; 0063 #include "llvm/BinaryFormat/MsgPack.def" 0064 } 0065 0066 /// The exact size encodable in "Fix" variants of formats. 0067 /// 0068 /// The only objects for which an exact size makes sense are of Extension type. 0069 /// 0070 /// For example, FixExt4 stores an extension type containing exactly four bytes. 0071 namespace FixLen { 0072 #define HANDLE_MP_FIX_LEN(ID, NAME) constexpr uint8_t NAME = ID; 0073 #include "llvm/BinaryFormat/MsgPack.def" 0074 } 0075 0076 /// The minimum value or size encodable in "Fix" variants of formats. 0077 /// 0078 /// The only object for which a minimum makes sense is a negative FixNum. 0079 /// 0080 /// Negative FixNum objects encode their signed integer value in one byte, but 0081 /// they must have the pattern "111" as their three most significant bits. This 0082 /// means all values are negative, and the smallest representable value is 0083 /// 0b11100000. 0084 namespace FixMin { 0085 #define HANDLE_MP_FIX_MIN(ID, NAME) constexpr int8_t NAME = ID; 0086 #include "llvm/BinaryFormat/MsgPack.def" 0087 } 0088 0089 } // end namespace msgpack 0090 } // end namespace llvm 0091 0092 #endif // LLVM_BINARYFORMAT_MSGPACK_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|