[riot-notifications] [RIOT-OS/RIOT] sys: Add helpers for pointer tagging (#15440)

Marian Buschsieweke notifications at github.com
Fri Nov 13 20:10:26 CET 2020


@maribu commented on this pull request.



> + * @details This will ensure a minimum alignment of 4 bytes
+ */
+#define PTRTAG  __attribute__((aligned(4)))
+
+/**
+ * @brief   Create a tagged pointer
+ * @param   ptr         Pointer to tag
+ * @param   tag         Tag to add
+ * @return              Tagged pointer encoding both @p ptr and @p tag
+ *
+ * @pre     @p ptr points to data marked with @ref PTRTAG
+ * @pre     @p tag contains a two bit value (its numeric value 0, 1, 2, or 3)
+ *
+ * Expect assertions blowing up when the preconditions are not met.
+ */
+static inline __attribute__((always_inline)) void * ptrtag(void *ptr, uint8_t tag)

Agreed

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15440#discussion_r523168052
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201113/549ada35/attachment.htm>


More information about the notifications mailing list