I want to create a huge array of ints 128 x 18,000,000, which is largest than the max array /vector size of C++ as presented in Is there a max array length limit in C++?.
One conceptual way is to store a pair of ints as a long where the first 32 bits is the first integer and the last 32 bits is the second integer. The question is how do I do that? Since, each time I am going to use both the integers comprising the long, I need something that would be fast and efficient. How do I take one long and split it in the two or how do I store 2 ints as a long?
Original allocation:
int nof1=64;
int nof2=18000000;
int *hugeArray;
int size = 2 * nof1 * nof2;
hugeArray = new int[size];
I have 16Gb of Ram and a 64bit Ubuntu 12.04 with gcc. So, main memory is not an issue. Still, I also have access to a 32GB PC with the same OS, so there is no need to worry about RAM.
Any suggestions would be appreciated. Thanks in advance.