+
+ /* Test all the regions as an unique sequential region.
+ * 1) Take the CRC64 of the memory region. */
+ for (j = 0; j < regions; j++) {
+ crc1 = crc64(crc1,(void*)start_vect[j],size_vect[j]);
+ }
+
+ /* 2) Invert bits, swap adiacent words, swap again, invert bits.
+ * This is the error amplification step. */
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_invert((void*)start_vect[j],size_vect[j]);
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_swap((void*)start_vect[j],size_vect[j]);
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_swap((void*)start_vect[j],size_vect[j]);
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_invert((void*)start_vect[j],size_vect[j]);
+
+ /* 3) Take the CRC64 sum again. */
+ for (j = 0; j < regions; j++)
+ crc2 = crc64(crc2,(void*)start_vect[j],size_vect[j]);
+
+ /* 4) Swap + Swap again */
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_swap((void*)start_vect[j],size_vect[j]);
+ for (j = 0; j < regions; j++)
+ memtest_non_destructive_swap((void*)start_vect[j],size_vect[j]);
+
+ /* 5) Take the CRC64 sum again. */
+ for (j = 0; j < regions; j++)
+ crc3 = crc64(crc3,(void*)start_vect[j],size_vect[j]);
+
+ /* NOTE: It is very important to close the file descriptor only now
+ * because closing it before may result into unmapping of some memory
+ * region that we are testing. */