I wrote a little blog post on storing data in pointers - initially motivated by documenting the impact of >48-bit virtual addresses on such tricks and the various available hardware pointer masking schemes https://muxup.com/2023q4/storing-data-in-pointers Any corrections or additional notes, do let me know!
Storing data in pointers

Some notes on storing data in pointers and the impact of >48-bit virtual addresses

Muxup
@asb i would note that for low-bits tagging you often don’t need to mask off the bits: if you know what they are you just subtract them, which is free for immediate offsets. allows e.g. [rax+8] for untagged to turn into [rax+7] for tagged
@wingo thanks! I've added a note to mention this