1 year ago

#340479

test-img

Samuel Okechukwu

Is there a portable way to tag a 1 byte aligned pointer?

I want to create a union of 2 pointers which have 1 byte alignment, but I don't want to store an additional tag, to distinguish them. I know that on some platforms, at least the most significant bit of a pointer is unused, but that might change in the future.

Please does someone know a portable way to do this?

I'm hoping for a technique that does not invalidate the original pointer. That is, is there a function for which when I apply it to some number n, frees up at least one bit in the number and when I "unapply" it, gives me back the original number.

pointers

rust

tagging

0 Answers

Your Answer

Accepted video resources