Your generosity is appreciated, both for what the code does and as an
example of "how it is done."
Absolutely, it's a cool little bit of code that does a single job well.
Some suggestions to whoever wishes to run further with this ball; I missed a method/function for converting an int64 into hex, that would be very easy to add and not possible any other way. Also a potentially lossy conversion to double (full marks if it can return an extra value indicating if truncation took place). tonumber(tostring) is clumsy and rather slow.
I think __pow should be overloaded with second integer argument for fast calculations of powers-of-two.
(And it would be cool if i64 would return the least significant byte, etc, with #i64 always being 8. __call can be used for a bit slice operator)