Using int64_t for sizes and indexes in array utils

Change-Id: I61177d868850c4538adbd77e413238d9cb2d9248
diff --git a/internal/ceres/array_utils.cc b/internal/ceres/array_utils.cc
index 8362618..e97ef6e 100644
--- a/internal/ceres/array_utils.cc
+++ b/internal/ceres/array_utils.cc
@@ -41,9 +41,9 @@
 
 namespace ceres::internal {
 
-bool IsArrayValid(const int size, const double* x) {
+bool IsArrayValid(const int64_t size, const double* x) {
   if (x != nullptr) {
-    for (int i = 0; i < size; ++i) {
+    for (int64_t i = 0; i < size; ++i) {
       if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
         return false;
       }
@@ -52,12 +52,12 @@
   return true;
 }
 
-int FindInvalidValue(const int size, const double* x) {
+int FindInvalidValue(const int64_t size, const double* x) {
   if (x == nullptr) {
     return size;
   }
 
-  for (int i = 0; i < size; ++i) {
+  for (int64_t i = 0; i < size; ++i) {
     if (!std::isfinite(x[i]) || (x[i] == kImpossibleValue)) {
       return i;
     }
@@ -66,16 +66,16 @@
   return size;
 }
 
-void InvalidateArray(const int size, double* x) {
+void InvalidateArray(const int64_t size, double* x) {
   if (x != nullptr) {
-    for (int i = 0; i < size; ++i) {
+    for (int64_t i = 0; i < size; ++i) {
       x[i] = kImpossibleValue;
     }
   }
 }
 
-void AppendArrayToString(const int size, const double* x, std::string* result) {
-  for (int i = 0; i < size; ++i) {
+void AppendArrayToString(const int64_t size, const double* x, std::string* result) {
+  for (int64_t i = 0; i < size; ++i) {
     if (x == nullptr) {
       StringAppendF(result, "Not Computed  ");
     } else {
@@ -88,13 +88,13 @@
   }
 }
 
-void MapValuesToContiguousRange(const int size, int* array) {
+void MapValuesToContiguousRange(const int64_t size, int* array) {
   std::vector<int> unique_values(array, array + size);
   std::sort(unique_values.begin(), unique_values.end());
   unique_values.erase(std::unique(unique_values.begin(), unique_values.end()),
                       unique_values.end());
 
-  for (int i = 0; i < size; ++i) {
+  for (int64_t i = 0; i < size; ++i) {
     array[i] =
         std::lower_bound(unique_values.begin(), unique_values.end(), array[i]) -
         unique_values.begin();
diff --git a/internal/ceres/array_utils.h b/internal/ceres/array_utils.h
index 059e2d5..8f4d41b 100644
--- a/internal/ceres/array_utils.h
+++ b/internal/ceres/array_utils.h
@@ -52,20 +52,20 @@
 
 // Fill the array x with an impossible value that the user code is
 // never expected to compute.
-CERES_NO_EXPORT void InvalidateArray(int size, double* x);
+CERES_NO_EXPORT void InvalidateArray(const int64_t size, double* x);
 
 // Check if all the entries of the array x are valid, i.e. all the
 // values in the array should be finite and none of them should be
 // equal to the "impossible" value used by InvalidateArray.
-CERES_NO_EXPORT bool IsArrayValid(int size, const double* x);
+CERES_NO_EXPORT bool IsArrayValid(const int64_t size, const double* x);
 
 // If the array contains an invalid value, return the index for it,
 // otherwise return size.
-CERES_NO_EXPORT int FindInvalidValue(const int size, const double* x);
+CERES_NO_EXPORT int64_t FindInvalidValue(const int64_t size, const double* x);
 
 // Utility routine to print an array of doubles to a string. If the
 // array pointer is nullptr, it is treated as an array of zeros.
-CERES_NO_EXPORT void AppendArrayToString(const int size,
+CERES_NO_EXPORT void AppendArrayToString(const int64_t size,
                                          const double* x,
                                          std::string* result);
 
@@ -82,7 +82,7 @@
 // gets mapped to
 //
 // [1 0 2 3 0 1 3]
-CERES_NO_EXPORT void MapValuesToContiguousRange(int size, int* array);
+CERES_NO_EXPORT void MapValuesToContiguousRange(const int64_t size, int* array);
 
 }  // namespace ceres::internal