I have used this library.
I have to perform bit operations on BigUnsigned numbers.
My code is
#include "BigIntegerLibrary.h"
BigUnsigned n1;
for (int i = 0; i < 100;i++)
{
if (i < 5)
{
n1.setBit(i,true);
}
else
{
n1.setBit(i,false);
}
}
BigUnsigned n2;
n2 = n1;
n2.bitShiftLeft(n2 , 40);
It gives me n2 is 0 instead of 34084860461056. Why is this happening?
It probably has something to do with the implementation of the library. I would highly recommend using GMP for this task. My solution would look something like this: