Sorry, I totally forgot about this post.

You can't create a 85 bit integer, but you can create an 88 bit integer (that's 11 bytes, if anyone keeps count). You don't necessarily need a struct for this, but you can use one. You really only need a contiguous block of 11 bytes of memory though.

Addition is fairly easy. Start with the least significant bit and and move up to the most significant bit, add the bits up and overflow to the left when necessary.

Multiplication can simply be implemented by repeatedly adding numbers (surprise, hu?)

Tricky is the printing part, because you need division and modulo for that. Here is a paper from Microsoft Research about integer division.

Once you have that in place, you take the modulo of the number and the 10, add that to the result string and divide the number by 10. Rinse and repeat until your number is 0. I've implemented something like this for my Firedrake kernel, it allows the usage of an arbitrary base, but you can simplify it if you need base 10 only: https://github.com/JustSid/Firedrake/blob/rewrite/lib/libc/stdlib.c#L56-L92


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com