Deprecate integral_types.h
This header defined integral types in the pre-C++11 days, and can
be replaced with <cstdint> and the types defined therein.
Also remove a shallow (and incorrect) typedef in include/ceres/types.h
https://github.com/ceres-solver/ceres-solver/issues/409
Change-Id: I398c652f74d24bbeea459672508bf28f591b100f
diff --git a/include/ceres/cost_function.h b/include/ceres/cost_function.h
index 1e085d6..39425e8 100644
--- a/include/ceres/cost_function.h
+++ b/include/ceres/cost_function.h
@@ -44,9 +44,9 @@
#ifndef CERES_PUBLIC_COST_FUNCTION_H_
#define CERES_PUBLIC_COST_FUNCTION_H_
+#include <cstdint>
#include <vector>
#include "ceres/internal/port.h"
-#include "ceres/types.h"
#include "ceres/internal/disable_warnings.h"
namespace ceres {
@@ -116,7 +116,7 @@
double* residuals,
double** jacobians) const = 0;
- const std::vector<int32>& parameter_block_sizes() const {
+ const std::vector<int32_t>& parameter_block_sizes() const {
return parameter_block_sizes_;
}
@@ -125,7 +125,7 @@
}
protected:
- std::vector<int32>* mutable_parameter_block_sizes() {
+ std::vector<int32_t>* mutable_parameter_block_sizes() {
return ¶meter_block_sizes_;
}
@@ -136,7 +136,7 @@
private:
// Cost function signature metadata: number of inputs & their sizes,
// number of outputs (residuals).
- std::vector<int32> parameter_block_sizes_;
+ std::vector<int32_t> parameter_block_sizes_;
int num_residuals_;
};
diff --git a/include/ceres/cost_function_to_functor.h b/include/ceres/cost_function_to_functor.h
index 8e30543..e17bc0e 100644
--- a/include/ceres/cost_function_to_functor.h
+++ b/include/ceres/cost_function_to_functor.h
@@ -88,12 +88,14 @@
#define CERES_PUBLIC_COST_FUNCTION_TO_FUNCTOR_H_
#include <numeric>
+#include <cstdint>
#include <vector>
#include "ceres/cost_function.h"
#include "ceres/dynamic_cost_function_to_functor.h"
#include "ceres/internal/fixed_array.h"
#include "ceres/internal/port.h"
+#include "ceres/types.h"
namespace ceres {
@@ -124,7 +126,7 @@
<< N3 << ", " << N4 << ", " << N5 << ", " << N6 << ", " << N7 << ", "
<< N8 << ", " << N9;
- const std::vector<int32>& parameter_block_sizes =
+ const std::vector<int32_t>& parameter_block_sizes =
cost_function->parameter_block_sizes();
const int num_parameter_blocks =
(N0 > 0) + (N1 > 0) + (N2 > 0) + (N3 > 0) + (N4 > 0) +
diff --git a/include/ceres/dynamic_cost_function_to_functor.h b/include/ceres/dynamic_cost_function_to_functor.h
index f6ff888..d4fce1c 100644
--- a/include/ceres/dynamic_cost_function_to_functor.h
+++ b/include/ceres/dynamic_cost_function_to_functor.h
@@ -114,7 +114,7 @@
template <typename JetT>
bool operator()(JetT const* const* inputs, JetT* output) const {
- const std::vector<int32>& parameter_block_sizes =
+ const std::vector<int32_t>& parameter_block_sizes =
cost_function_->parameter_block_sizes();
const int num_parameter_blocks =
static_cast<int>(parameter_block_sizes.size());
@@ -170,7 +170,7 @@
output[i].v.setZero();
for (int j = 0; j < num_parameter_blocks; ++j) {
- const int32 block_size = parameter_block_sizes[j];
+ const int32_t block_size = parameter_block_sizes[j];
for (int k = 0; k < parameter_block_sizes[j]; ++k) {
output[i].v +=
jacobian_blocks[j][i * block_size + k] * inputs[j][k].v;
diff --git a/include/ceres/dynamic_numeric_diff_cost_function.h b/include/ceres/dynamic_numeric_diff_cost_function.h
index 4c2766f..d5806ee 100644
--- a/include/ceres/dynamic_numeric_diff_cost_function.h
+++ b/include/ceres/dynamic_numeric_diff_cost_function.h
@@ -98,7 +98,7 @@
<< "You must call DynamicNumericDiffCostFunction::SetNumResiduals() "
<< "before DynamicNumericDiffCostFunction::Evaluate().";
- const std::vector<int32>& block_sizes = parameter_block_sizes();
+ const std::vector<int32_t>& block_sizes = parameter_block_sizes();
CHECK(!block_sizes.empty())
<< "You must call DynamicNumericDiffCostFunction::AddParameterBlock() "
<< "before DynamicNumericDiffCostFunction::Evaluate().";
diff --git a/include/ceres/iteration_callback.h b/include/ceres/iteration_callback.h
index db5d0ef..bd1e782 100644
--- a/include/ceres/iteration_callback.h
+++ b/include/ceres/iteration_callback.h
@@ -64,7 +64,7 @@
cumulative_time_in_seconds(0.0) {}
// Current iteration number.
- int32 iteration;
+ int iteration;
// Step was numerically valid, i.e., all values are finite and the
// step reduces the value of the linearized model.
diff --git a/include/ceres/sized_cost_function.h b/include/ceres/sized_cost_function.h
index b10421e..f9a984f 100644
--- a/include/ceres/sized_cost_function.h
+++ b/include/ceres/sized_cost_function.h
@@ -38,8 +38,8 @@
#ifndef CERES_PUBLIC_SIZED_COST_FUNCTION_H_
#define CERES_PUBLIC_SIZED_COST_FUNCTION_H_
-#include "ceres/types.h"
#include "ceres/cost_function.h"
+#include "ceres/types.h"
#include "glog/logging.h"
namespace ceres {
diff --git a/include/ceres/types.h b/include/ceres/types.h
index f6dd6a1..23ec8f7 100644
--- a/include/ceres/types.h
+++ b/include/ceres/types.h
@@ -44,10 +44,6 @@
namespace ceres {
-// Basic integer types. These typedefs are in the Ceres namespace to avoid
-// conflicts with other packages having similar typedefs.
-typedef int int32;
-
// Argument type used in interfaces that can optionally take ownership
// of a passed in argument. If TAKE_OWNERSHIP is passed, the called
// object takes ownership of the pointer argument, and will call
diff --git a/internal/ceres/block_jacobi_preconditioner.cc b/internal/ceres/block_jacobi_preconditioner.cc
index 22d4b35..772c7af 100644
--- a/internal/ceres/block_jacobi_preconditioner.cc
+++ b/internal/ceres/block_jacobi_preconditioner.cc
@@ -34,7 +34,6 @@
#include "ceres/block_structure.h"
#include "ceres/block_random_access_diagonal_matrix.h"
#include "ceres/casts.h"
-#include "ceres/integral_types.h"
#include "ceres/internal/eigen.h"
namespace ceres {
diff --git a/internal/ceres/block_random_access_diagonal_matrix.h b/internal/ceres/block_random_access_diagonal_matrix.h
index 1eba575..6ad976f 100644
--- a/internal/ceres/block_random_access_diagonal_matrix.h
+++ b/internal/ceres/block_random_access_diagonal_matrix.h
@@ -37,7 +37,6 @@
#include <vector>
#include "ceres/block_random_access_matrix.h"
-#include "ceres/integral_types.h"
#include "ceres/internal/port.h"
#include "ceres/triplet_sparse_matrix.h"
#include "ceres/types.h"
diff --git a/internal/ceres/block_random_access_sparse_matrix.h b/internal/ceres/block_random_access_sparse_matrix.h
index b05096c..12244a5 100644
--- a/internal/ceres/block_random_access_sparse_matrix.h
+++ b/internal/ceres/block_random_access_sparse_matrix.h
@@ -31,6 +31,7 @@
#ifndef CERES_INTERNAL_BLOCK_RANDOM_ACCESS_SPARSE_MATRIX_H_
#define CERES_INTERNAL_BLOCK_RANDOM_ACCESS_SPARSE_MATRIX_H_
+#include <cstdint>
#include <memory>
#include <set>
#include <unordered_map>
@@ -39,7 +40,6 @@
#include "ceres/block_random_access_matrix.h"
#include "ceres/triplet_sparse_matrix.h"
-#include "ceres/integral_types.h"
#include "ceres/internal/port.h"
#include "ceres/types.h"
#include "ceres/small_blas.h"
@@ -93,16 +93,16 @@
TripletSparseMatrix* mutable_matrix() { return tsm_.get(); }
private:
- int64 IntPairToLong(int row, int col) const {
+ int64_t IntPairToLong(int row, int col) const {
return row * kMaxRowBlocks + col;
}
- void LongToIntPair(int64 index, int* row, int* col) const {
+ void LongToIntPair(int64_t index, int* row, int* col) const {
*row = index / kMaxRowBlocks;
*col = index % kMaxRowBlocks;
}
- const int64 kMaxRowBlocks;
+ const int64_t kMaxRowBlocks;
// row/column block sizes.
const std::vector<int> blocks_;
diff --git a/internal/ceres/block_random_access_sparse_matrix_test.cc b/internal/ceres/block_random_access_sparse_matrix_test.cc
index bae33b9..9ca9c46 100644
--- a/internal/ceres/block_random_access_sparse_matrix_test.cc
+++ b/internal/ceres/block_random_access_sparse_matrix_test.cc
@@ -148,14 +148,14 @@
}
void CheckIntPairToLong(int a, int b) {
- int64 value = m_->IntPairToLong(a, b);
+ int64_t value = m_->IntPairToLong(a, b);
EXPECT_GT(value, 0) << "Overflow a = " << a << " b = " << b;
EXPECT_GT(value, a) << "Overflow a = " << a << " b = " << b;
EXPECT_GT(value, b) << "Overflow a = " << a << " b = " << b;
}
void CheckLongToIntPair() {
- uint64 max_rows = m_->kMaxRowBlocks;
+ uint64_t max_rows = m_->kMaxRowBlocks;
for (int row = max_rows - 10; row < max_rows; ++row) {
for (int col = 0; col < 10; ++col) {
int row_computed;
diff --git a/internal/ceres/block_structure.h b/internal/ceres/block_structure.h
index 9d1b5e9..5761a1f 100644
--- a/internal/ceres/block_structure.h
+++ b/internal/ceres/block_structure.h
@@ -40,12 +40,11 @@
#include <vector>
#include "ceres/internal/port.h"
-#include "ceres/types.h"
namespace ceres {
namespace internal {
-typedef int32 BlockSize;
+typedef int32_t BlockSize;
struct Block {
Block() : size(-1), position(-1) {}
diff --git a/internal/ceres/cost_function_to_functor_test.cc b/internal/ceres/cost_function_to_functor_test.cc
index 5878d3b..52687ea 100644
--- a/internal/ceres/cost_function_to_functor_test.cc
+++ b/internal/ceres/cost_function_to_functor_test.cc
@@ -30,6 +30,7 @@
#include "ceres/cost_function_to_functor.h"
+#include <cstdint>
#include <memory>
#include "ceres/dynamic_autodiff_cost_function.h"
#include "ceres/dynamic_cost_function_to_functor.h"
@@ -47,9 +48,9 @@
EXPECT_EQ(cost_function.num_residuals(),
actual_cost_function.num_residuals());
const int num_residuals = cost_function.num_residuals();
- const vector<int32>& parameter_block_sizes =
+ const vector<int32_t>& parameter_block_sizes =
cost_function.parameter_block_sizes();
- const vector<int32>& actual_parameter_block_sizes =
+ const vector<int32_t>& actual_parameter_block_sizes =
actual_cost_function.parameter_block_sizes();
EXPECT_EQ(parameter_block_sizes.size(),
actual_parameter_block_sizes.size());
diff --git a/internal/ceres/covariance_test.cc b/internal/ceres/covariance_test.cc
index 9c55136..dea0723 100644
--- a/internal/ceres/covariance_test.cc
+++ b/internal/ceres/covariance_test.cc
@@ -31,6 +31,7 @@
#include "ceres/covariance.h"
#include <algorithm>
+#include <cstdint>
#include <cmath>
#include <map>
#include <memory>
@@ -55,7 +56,7 @@
class UnaryCostFunction: public CostFunction {
public:
UnaryCostFunction(const int num_residuals,
- const int32 parameter_block_size,
+ const int32_t parameter_block_size,
const double* jacobian)
: jacobian_(jacobian, jacobian + num_residuals * parameter_block_size) {
set_num_residuals(num_residuals);
@@ -88,8 +89,8 @@
class BinaryCostFunction: public CostFunction {
public:
BinaryCostFunction(const int num_residuals,
- const int32 parameter_block1_size,
- const int32 parameter_block2_size,
+ const int32_t parameter_block1_size,
+ const int32_t parameter_block2_size,
const double* jacobian1,
const double* jacobian2)
: jacobian1_(jacobian1,
diff --git a/internal/ceres/gradient_checker.cc b/internal/ceres/gradient_checker.cc
index c16c141..d231c83 100644
--- a/internal/ceres/gradient_checker.cc
+++ b/internal/ceres/gradient_checker.cc
@@ -34,6 +34,7 @@
#include <algorithm>
#include <cmath>
+#include <cstdint>
#include <numeric>
#include <string>
#include <vector>
@@ -65,7 +66,7 @@
CHECK_NOTNULL(jacobians);
CHECK_NOTNULL(local_jacobians);
- const vector<int32>& block_sizes = function->parameter_block_sizes();
+ const vector<int32_t>& block_sizes = function->parameter_block_sizes();
const int num_parameter_blocks = block_sizes.size();
// Allocate Jacobian matrices in local space.
@@ -135,7 +136,7 @@
function, DO_NOT_TAKE_OWNERSHIP, options);
finite_diff_cost_function_.reset(finite_diff_cost_function);
- const vector<int32>& parameter_block_sizes =
+ const vector<int32_t>& parameter_block_sizes =
function->parameter_block_sizes();
const int num_parameter_blocks = parameter_block_sizes.size();
for (int i = 0; i < num_parameter_blocks; ++i) {
diff --git a/internal/ceres/gradient_checking_cost_function.cc b/internal/ceres/gradient_checking_cost_function.cc
index 6e2a82c..b402844 100644
--- a/internal/ceres/gradient_checking_cost_function.cc
+++ b/internal/ceres/gradient_checking_cost_function.cc
@@ -33,6 +33,7 @@
#include <algorithm>
#include <cmath>
+#include <cstdint>
#include <numeric>
#include <string>
#include <vector>
@@ -74,7 +75,7 @@
extra_info_(extra_info),
callback_(callback) {
CHECK_NOTNULL(callback_);
- const vector<int32>& parameter_block_sizes =
+ const vector<int32_t>& parameter_block_sizes =
function->parameter_block_sizes();
*mutable_parameter_block_sizes() = parameter_block_sizes;
set_num_residuals(function->num_residuals());
@@ -106,7 +107,7 @@
MatrixRef(residuals, num_residuals, 1) = results.residuals;
// Copy the original jacobian blocks into the jacobians array.
- const vector<int32>& block_sizes = function_->parameter_block_sizes();
+ const vector<int32_t>& block_sizes = function_->parameter_block_sizes();
for (int k = 0; k < block_sizes.size(); k++) {
if (jacobians[k] != NULL) {
MatrixRef(jacobians[k],
diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc
index fc8e071..2a0390c 100644
--- a/internal/ceres/gradient_checking_cost_function_test.cc
+++ b/internal/ceres/gradient_checking_cost_function_test.cc
@@ -31,6 +31,7 @@
#include "ceres/gradient_checking_cost_function.h"
#include <cmath>
+#include <cstdint>
#include <memory>
#include <vector>
@@ -261,7 +262,7 @@
// Trivial cost function that accepts a single argument.
class UnaryCostFunction : public CostFunction {
public:
- UnaryCostFunction(int num_residuals, int32 parameter_block_size) {
+ UnaryCostFunction(int num_residuals, int32_t parameter_block_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block_size);
}
@@ -281,8 +282,8 @@
class BinaryCostFunction: public CostFunction {
public:
BinaryCostFunction(int num_residuals,
- int32 parameter_block1_size,
- int32 parameter_block2_size) {
+ int32_t parameter_block1_size,
+ int32_t parameter_block2_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block1_size);
mutable_parameter_block_sizes()->push_back(parameter_block2_size);
@@ -302,9 +303,9 @@
class TernaryCostFunction: public CostFunction {
public:
TernaryCostFunction(int num_residuals,
- int32 parameter_block1_size,
- int32 parameter_block2_size,
- int32 parameter_block3_size) {
+ int32_t parameter_block1_size,
+ int32_t parameter_block2_size,
+ int32_t parameter_block3_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block1_size);
mutable_parameter_block_sizes()->push_back(parameter_block2_size);
diff --git a/internal/ceres/graph.h b/internal/ceres/graph.h
index 079d31d..4e1fd81 100644
--- a/internal/ceres/graph.h
+++ b/internal/ceres/graph.h
@@ -35,7 +35,6 @@
#include <unordered_set>
#include <unordered_map>
#include <utility>
-#include "ceres/integral_types.h"
#include "ceres/map_util.h"
#include "ceres/pair_hash.h"
#include "ceres/types.h"
diff --git a/internal/ceres/integral_types.h b/internal/ceres/integral_types.h
deleted file mode 100644
index 98a746f..0000000
--- a/internal/ceres/integral_types.h
+++ /dev/null
@@ -1,91 +0,0 @@
-// Ceres Solver - A fast non-linear least squares minimizer
-// Copyright 2015 Google Inc. All rights reserved.
-// http://ceres-solver.org/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// * Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-// * Neither the name of Google Inc. nor the names of its contributors may be
-// used to endorse or promote products derived from this software without
-// specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-//
-// Author: keir@google.com (Keir Mierle)
-//
-// Portable typedefs for various fixed-size integers. Uses template
-// metaprogramming instead of fragile compiler defines.
-
-#ifndef CERES_INTERNAL_INTEGRAL_TYPES_H_
-#define CERES_INTERNAL_INTEGRAL_TYPES_H_
-
-namespace ceres {
-namespace internal {
-
-// Compile time ternary on types.
-template<bool kCondition, typename kTrueType, typename kFalseType>
-struct Ternary {
- typedef kTrueType type;
-};
-template<typename kTrueType, typename kFalseType>
-struct Ternary<false, kTrueType, kFalseType> {
- typedef kFalseType type;
-};
-
-#define CERES_INTSIZE(TYPE) \
- typename Ternary<sizeof(TYPE) * 8 == kBits, TYPE,
-
-template<int kBits>
-struct Integer {
- typedef
- CERES_INTSIZE(char)
- CERES_INTSIZE(short)
- CERES_INTSIZE(int)
- CERES_INTSIZE(long int)
- CERES_INTSIZE(long long)
- void>::type >::type >::type >::type >::type
- type;
-};
-
-template<int kBits>
-struct UnsignedInteger {
- typedef
- CERES_INTSIZE(unsigned char)
- CERES_INTSIZE(unsigned short)
- CERES_INTSIZE(unsigned int)
- CERES_INTSIZE(unsigned long int)
- CERES_INTSIZE(unsigned long long)
- void>::type >::type >::type >::type >::type
- type;
-};
-
-#undef CERES_INTSIZE
-
-typedef Integer< 8>::type int8;
-typedef Integer<32>::type int32;
-typedef Integer<64>::type int64;
-
-typedef UnsignedInteger< 8>::type uint8;
-typedef UnsignedInteger<16>::type uint16;
-typedef UnsignedInteger<32>::type uint32;
-typedef UnsignedInteger<64>::type uint64;
-
-} // namespace internal
-} // namespace ceres
-
-#endif // CERES_INTERNAL_INTEGRAL_TYPES_H_
diff --git a/internal/ceres/pair_hash.h b/internal/ceres/pair_hash.h
index 7fb32cf..80453ba 100644
--- a/internal/ceres/pair_hash.h
+++ b/internal/ceres/pair_hash.h
@@ -34,8 +34,8 @@
#define CERES_INTERNAL_PAIR_HASH_H_
#include "ceres/internal/port.h"
+#include <cstdint>
#include <utility>
-#include "ceres/integral_types.h"
namespace ceres {
namespace internal {
@@ -54,7 +54,7 @@
// instructions in 27 cycles, if you're lucky.
//
// 32bit version
-inline void hash_mix(uint32& a, uint32& b, uint32& c) {
+inline void hash_mix(uint32_t& a, uint32_t& b, uint32_t& c) {
a -= b; a -= c; a ^= (c>>13);
b -= c; b -= a; b ^= (a<<8);
c -= a; c -= b; c ^= (b>>13);
@@ -67,7 +67,7 @@
}
// 64bit version
-inline void hash_mix(uint64& a, uint64& b, uint64& c) {
+inline void hash_mix(uint64_t& a, uint64_t& b, uint64_t& c) {
a -= b; a -= c; a ^= (c>>43);
b -= c; b -= a; b ^= (a<<9);
c -= a; c -= b; c ^= (b>>8);
@@ -79,16 +79,16 @@
c -= a; c -= b; c ^= (b>>11);
}
-inline uint32 Hash32NumWithSeed(uint32 num, uint32 c) {
+inline uint32_t Hash32NumWithSeed(uint32_t num, uint32_t c) {
// The golden ratio; an arbitrary value.
- uint32 b = 0x9e3779b9UL;
+ uint32_t b = 0x9e3779b9UL;
hash_mix(num, b, c);
return c;
}
-inline uint64 Hash64NumWithSeed(uint64 num, uint64 c) {
+inline uint64_t Hash64NumWithSeed(uint64_t num, uint64_t c) {
// More of the golden ratio.
- uint64 b = GG_ULONGLONG(0xe08c1d668b756f82);
+ uint64_t b = GG_ULONGLONG(0xe08c1d668b756f82);
hash_mix(num, b, c);
return c;
}
@@ -101,8 +101,8 @@
const std::size_t h1 = std::hash<T>()(p.first);
const std::size_t h2 = std::hash<T>()(p.second);
// The decision below is at compile time
- return (sizeof(h1) <= sizeof(uint32)) ? Hash32NumWithSeed(h1, h2)
- : Hash64NumWithSeed(h1, h2);
+ return (sizeof(h1) <= sizeof(uint32_t)) ? Hash32NumWithSeed(h1, h2)
+ : Hash64NumWithSeed(h1, h2);
}
};
diff --git a/internal/ceres/parameter_block.h b/internal/ceres/parameter_block.h
index c07edef..c074042 100644
--- a/internal/ceres/parameter_block.h
+++ b/internal/ceres/parameter_block.h
@@ -32,13 +32,13 @@
#define CERES_INTERNAL_PARAMETER_BLOCK_H_
#include <algorithm>
+#include <cstdint>
#include <cstdlib>
#include <memory>
#include <limits>
#include <string>
#include <unordered_set>
#include "ceres/array_utils.h"
-#include "ceres/integral_types.h"
#include "ceres/internal/eigen.h"
#include "ceres/internal/port.h"
#include "ceres/local_parameterization.h"
@@ -393,13 +393,13 @@
// The index of the parameter. This is used by various other parts of Ceres to
// permit switching from a ParameterBlock* to an index in another array.
- int32 index_;
+ int32_t index_;
// The offset of this parameter block inside a larger state vector.
- int32 state_offset_;
+ int32_t state_offset_;
// The offset of this parameter block inside a larger delta vector.
- int32 delta_offset_;
+ int32_t delta_offset_;
// If non-null, contains the residual blocks this parameter block is in.
std::unique_ptr<ResidualBlockSet> residual_blocks_;
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index f627659..984e3ca 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -33,6 +33,7 @@
#include <algorithm>
#include <cstddef>
+#include <cstdint>
#include <iterator>
#include <memory>
#include <set>
@@ -294,7 +295,7 @@
cost_function->parameter_block_sizes().size());
// Check the sizes match.
- const vector<int32>& parameter_block_sizes =
+ const vector<int32_t>& parameter_block_sizes =
cost_function->parameter_block_sizes();
if (!options_.disable_all_safety_checks) {
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc
index 8012583..cdc0ef5 100644
--- a/internal/ceres/problem_test.cc
+++ b/internal/ceres/problem_test.cc
@@ -59,7 +59,7 @@
// Trivial cost function that accepts a single argument.
class UnaryCostFunction : public CostFunction {
public:
- UnaryCostFunction(int num_residuals, int32 parameter_block_size) {
+ UnaryCostFunction(int num_residuals, int32_t parameter_block_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block_size);
}
@@ -79,8 +79,8 @@
class BinaryCostFunction: public CostFunction {
public:
BinaryCostFunction(int num_residuals,
- int32 parameter_block1_size,
- int32 parameter_block2_size) {
+ int32_t parameter_block1_size,
+ int32_t parameter_block2_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block1_size);
mutable_parameter_block_sizes()->push_back(parameter_block2_size);
@@ -100,9 +100,9 @@
class TernaryCostFunction: public CostFunction {
public:
TernaryCostFunction(int num_residuals,
- int32 parameter_block1_size,
- int32 parameter_block2_size,
- int32 parameter_block3_size) {
+ int32_t parameter_block1_size,
+ int32_t parameter_block2_size,
+ int32_t parameter_block3_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block1_size);
mutable_parameter_block_sizes()->push_back(parameter_block2_size);
diff --git a/internal/ceres/residual_block.h b/internal/ceres/residual_block.h
index 815a7a1..8b8b8ae 100644
--- a/internal/ceres/residual_block.h
+++ b/internal/ceres/residual_block.h
@@ -34,6 +34,7 @@
#ifndef CERES_INTERNAL_RESIDUAL_BLOCK_H_
#define CERES_INTERNAL_RESIDUAL_BLOCK_H_
+#include <cstdint>
#include <memory>
#include <string>
#include <vector>
@@ -139,7 +140,7 @@
// The index of the residual, typically in a Program. This is only to permit
// switching from a ResidualBlock* to an index in the Program's array, needed
// to do efficient removals.
- int32 index_;
+ int32_t index_;
};
} // namespace internal
diff --git a/internal/ceres/residual_block_test.cc b/internal/ceres/residual_block_test.cc
index 673744b..3a33be7 100644
--- a/internal/ceres/residual_block_test.cc
+++ b/internal/ceres/residual_block_test.cc
@@ -30,6 +30,7 @@
#include "ceres/residual_block.h"
+#include <cstdint>
#include "gtest/gtest.h"
#include "ceres/parameter_block.h"
#include "ceres/sized_cost_function.h"
@@ -45,9 +46,9 @@
class TernaryCostFunction: public CostFunction {
public:
TernaryCostFunction(int num_residuals,
- int32 parameter_block1_size,
- int32 parameter_block2_size,
- int32 parameter_block3_size) {
+ int32_t parameter_block1_size,
+ int32_t parameter_block2_size,
+ int32_t parameter_block3_size) {
set_num_residuals(num_residuals);
mutable_parameter_block_sizes()->push_back(parameter_block1_size);
mutable_parameter_block_sizes()->push_back(parameter_block2_size);