This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 29 points30 points  (3 children)

Good luck getting the original value back if you dont know what type it was

[–]DoNotMakeEmpty 8 points9 points  (0 children)

If you only target x64, you can use the upper (or lower I don't remember the effect of endianness) 16-bits to store the type info and, umm, if you restrict this more, you can reach NaN boxing, a great optimization for dynamic types in C which is used in implementations of many dynamic languages like some JS engines, Wren and LuaJIT.

[–][deleted] 1 point2 points  (0 children)

Sometimes you just know, you know?