@@ -107,6 +107,78 @@ extern "C" {
107107 BT_BYTES_LIST_LE32(_v), \
108108 BT_BYTES_LIST_LE32((_v) >> 32) \
109109
110+ /** @brief Encode 16-bit value into array values in big-endian format.
111+ *
112+ * Helper macro to encode 16-bit values into comma separated values.
113+ *
114+ * @note @p _v is evaluated 2 times.
115+ *
116+ * @param _v 16-bit integer in host endianness.
117+ *
118+ * @return The comma separated values for the 16-bit value.
119+ */
120+ #define BT_BYTES_LIST_BE16 (_v ) (((_v) >> 8) & 0xFFU), (((_v) >> 0) & 0xFFU)
121+
122+ /** @brief Encode 24-bit value into array values in big-endian format.
123+ *
124+ * Helper macro to encode 24-bit values into comma separated values.
125+ *
126+ * @note @p _v is evaluated 3 times.
127+ *
128+ * @param _v 24-bit integer in host endianness.
129+ *
130+ * @return The comma separated values for the 24-bit value.
131+ */
132+ #define BT_BYTES_LIST_BE24 (_v ) (((_v) >> 16) & 0xFFU), BT_BYTES_LIST_BE16(_v)
133+
134+ /** @brief Encode 32-bit value into array values in big-endian format.
135+ *
136+ * Helper macro to encode 32-bit values into comma separated values.
137+ *
138+ * @note @p _v is evaluated 4 times.
139+ *
140+ * @param _v 32-bit integer in host endianness.
141+ *
142+ * @return The comma separated values for the 32-bit value.
143+ */
144+ #define BT_BYTES_LIST_BE32 (_v ) (((_v) >> 24) & 0xFFU), BT_BYTES_LIST_BE24(_v)
145+
146+ /** @brief Encode 40-bit value into array values in big-endian format.
147+ *
148+ * Helper macro to encode 40-bit values into comma separated values.
149+ *
150+ * @note @p _v is evaluated 5 times.
151+ *
152+ * @param _v 40-bit integer in host endianness.
153+ *
154+ * @return The comma separated values for the 40-bit value.
155+ */
156+ #define BT_BYTES_LIST_BE40 (_v ) BT_BYTES_LIST_BE16((_v) >> 24), BT_BYTES_LIST_BE24(_v)
157+
158+ /** @brief Encode 48-bit value into array values in big-endian format.
159+ *
160+ * Helper macro to encode 48-bit values into comma separated values.
161+ *
162+ * @note @p _v is evaluated 6 times.
163+ *
164+ * @param _v 48-bit integer in host endianness.
165+ *
166+ * @return The comma separated values for the 48-bit value.
167+ */
168+ #define BT_BYTES_LIST_BE48 (_v ) BT_BYTES_LIST_BE16((_v) >> 32), BT_BYTES_LIST_BE32(_v)
169+
170+ /** @brief Encode 64-bit value into array values in big-endian format.
171+ *
172+ * Helper macro to encode 64-bit values into comma separated values.
173+ *
174+ * @note @p _v is evaluated 8 times.
175+ *
176+ * @param _v 64-bit integer in host endianness.
177+ *
178+ * @return The comma separated values for the 64-bit value.
179+ */
180+ #define BT_BYTES_LIST_BE64 (_v ) BT_BYTES_LIST_BE32((_v) >> 32), BT_BYTES_LIST_BE32(_v)
181+
110182/**
111183 * @}
112184 */
0 commit comments