   Big number representation
  I was wondering, what would be a good solution for representing big integer numbers internally such that operations like: addition, subtraction, division, xor, and, or, negation could be performed fast.How would you perform the XOR operation given your the representation you propose?   
  Take a look at the common bignum implementations. Gnu MultiPrecision library is open source and quite speedy. Looks to be some sort of tree or collection of byte collections at first glance.   ;Quote:Original post by TelastynTake a look at the common bignum implementations. Gnu MultiPrecision library is open source and quite speedy. Looks to be some sort of tree or collection of byte collections at first glance.I was looking for something like this. thanks;  Well, since you asked how I would do it, this is exactly how I do it. See Bigint.h here.I store it exactly as a processor that simply had a much larger register size would, in standard two's-complement form. All operations work as expected.In practice though it often useful to use a variable-sized representation.   ;  GMP represents signed integers essentially like so:struct Number {    unsigned long *n;    int size;    int alloc;};alloc represents the size of the allocation at N;|size| represents the number of digits required to represent the number (meaning n[|size|+1] ... n[alloc-1] = 0)the sign of size represents the sign of the integer.So then the value of the number is sign(size) * Sum_i=0...size-1 n * B^i where B is ULONG_MAX+1By representing the number in a base native to the computer (32 or 64 bits) you can maximize the performance of your computation routines.