You've represented a bignum as an array of base-2 (binary) digits.
Real bignum libraries don't use a base of 2. They use a much larger base, because CPUs have instructions that operate on more than one bit at a time. Typically you would use a base of 256 (28), 65536 (216), 4294967296 (232), or 18446744073709551616 (264) if your goal is maximum speed and minimum size, or a base of 100 (with one byte per digit), 10000 (with two bytes per digit), 1000000000 (with four bytes per digit), or 10000000000000000000 (with eight bytes per digit) if you must store precise decimal fractions.
You need to use something like vector<uint32_t>
or vector<uint64_t>
as your bignum, and operate on 32 or 64 bits at a time instead of just 1 bit at a time.