   long minLengthOwnLimbs = LLONG_MAX;
   for(int i = 0; i < nr_rows; ++i)
     for(int j = 0; j < nr_cols; ++j) {
-      generateLongsFromGMP(a[j * nr_rows + i], tmpX[j * nr_rows + i], lengthOwnLimbs[j * nr_rows + i], maxBits, maxExp); 
+      generateLongsFromGMP(a[j * nr_rows + i], tmpX[j * nr_rows + i], lengthOwnLimbs[j * nr_rows + i], ownLimbSize, maxExp); 
       if (minLengthOwnLimbs > lengthOwnLimbs[j * nr_rows + i]) minLengthOwnLimbs = lengthOwnLimbs[j * nr_rows + i];
     }
 

}

// NOT TESTED
void longToGMP(mpf_class &a, const long long *toAdd, const int size_toAdd, const int maxBits, const int whereWeStart) {
  // Is the precision a global variable?... I assume so?
  a = mpf_class("0");
  for (int i = 0; i < size_toAdd; i++) {
    addToGMP(a, toAdd[i], whereWeStart - (i + 1) * maxBits)
  }
}


  std::cout << tmp << std::endl;
}

// TODO: Eventually decouple allocation from calculation
//
void generateLongsFromGMP(const mpf_class a, long long *&x, int &sizeOfArray, const int ownLimbSize, const int padExp) {
  int size = a.get_mpf_t()->_mp_size; 
  // WARNING: _mp_exp is number of limbs, not actual exponent!
  // TODO: Test the fix below
  int realExp = a.get_mpf_t()->_mp_exp * INT64L;
  int padding = (padExp - realExp) / ownLimbSize;
  int padBitOffset = (padExp - realExp) % ownLimbSize;
  
  // Assert that the padding will work and that the maximumBitSize is given appropraitely 
  assert(realExp <= padExp);
  assert(ownLimbSize <= INT64L);

  // Find size of needed 64-bit variable array with padding and allocate it in memory
  sizeOfArray = (INT64L * size + (padExp - realExp)) / ownLimbSize;
  
  if ((INT64L * size + (padExp - realExp)) % ownLimbSize != 0) sizeOfArray += 1; 
  x = (long long *)malloc(sizeOfArray * sizeof(long long));
  
  // Add padding
