So I kind of allocate enough memory that gives me 64 bits and than somehow create all the operations like + and - using bit manipulations?
If so how do I even play around with specific bits in memory?
It's worth having a dig into the system header files, it might seem a bit cryptic, but there are things to learn.
Edit:
So really what is happening, the typedef just creates an alias for an existing type, so all the operations already work. :+) One can do the same with a using statement (the same as typedef in this respect)
using my_int_64 = unsignedlongint;
Though I am not sure why you would want to do this?
turns out I wanted to know how those build in types are implemented because I want to do an exercise as efficient as possible and implement class for arbitrary precision calculations. I thought I can find an answer behind types such as int64_t but turns out that its not different than signedlonglongint.
Maybe they are implemented in Assembly? For example if in the future there is strong need for some 128 bit numbers. How is the int128_t will be implemented?
Obviously after its done its easy to name it typedef uber ultra int int128_t. But it doesnt work without int128_t being implemented at 1st
Maybe they are implemented in Assembly? For example if in the future there is strong need for some 128 bit numbers. How is the int128_t will be implemented?
Storage and arithmetic on built-in types is provided by the hardware, generally. The hardware must be able to directly support operations on such numbers. If it doesn't, then the implementation may choose simply to not define those types, in which case the program will fail to compile.
It's possible for, say, an x86 C++ compiler to implement a hypothetical uint256_t (x86 processors only support arithmetic on 64-bit values and smaller). In that case, the operations would be implemented in the compiler in the same way that if, and adding two numbers, for example, would be replaced by a series of instructions that perform an equivalent operation on the memory location. This implementation would of course be much less efficient than if the hardware supported 256-bit integers.