diff options
author | Benoit Jacob <benoitjacob@google.com> | 2015-03-17 10:31:45 -0400 |
---|---|---|
committer | Benoit Jacob <benoitjacob@google.com> | 2015-03-17 10:31:45 -0400 |
commit | dc04f12967a955125fa2eeb8ed4f1532f8ee3615 (patch) | |
tree | 9427295063966be8d15d54179b66c6590010694b | |
parent | 364cfd529d853545e6b0a7404fe303cda2de2366 (diff) |
use unsigned short instead of uint16_t which doesn't exist in c++98
-rw-r--r-- | Eigen/Core | 1 | ||||
-rw-r--r-- | Eigen/src/Core/arch/NEON/BlockingSizesLookupTables.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/products/LookupBlockingSizesTable.h | 20 | ||||
-rw-r--r-- | bench/analyze-blocking-sizes.cpp | 4 |
4 files changed, 14 insertions, 15 deletions
diff --git a/Eigen/Core b/Eigen/Core index 80842a1de..1a3249604 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -61,7 +61,6 @@ #pragma GCC optimize ("-fno-ipa-cp-clone") #endif -#include <stdint.h> #include <complex> // this include file manages BLAS and MKL related macros diff --git a/Eigen/src/Core/arch/NEON/BlockingSizesLookupTables.h b/Eigen/src/Core/arch/NEON/BlockingSizesLookupTables.h index 7905bdf83..5007c155d 100644 --- a/Eigen/src/Core/arch/NEON/BlockingSizesLookupTables.h +++ b/Eigen/src/Core/arch/NEON/BlockingSizesLookupTables.h @@ -32,8 +32,8 @@ template<> struct BlockingSizesLookupTable<float, float> { static const size_t BaseSize = 16; static const size_t NumSizes = 8; - static const uint16_t* Data() { - static const uint16_t data[512] = { + static const unsigned short* Data() { + static const unsigned short data[512] = { 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x447, 0x447, 0x454, 0x455, 0x456, 0x457, 0x458, 0x459, 0x45a, 0x456, 0x464, 0x465, 0x466, 0x467, 0x468, 0x469, 0x46a, 0x467, diff --git a/Eigen/src/Core/products/LookupBlockingSizesTable.h b/Eigen/src/Core/products/LookupBlockingSizesTable.h index 3c8aba6f8..5ab4525df 100644 --- a/Eigen/src/Core/products/LookupBlockingSizesTable.h +++ b/Eigen/src/Core/products/LookupBlockingSizesTable.h @@ -25,9 +25,9 @@ struct LookupBlockingSizesFromTableImpl } }; -inline uint8_t floor_log2_helper(uint16_t& x, size_t offset) +inline size_t floor_log2_helper(unsigned short& x, size_t offset) { - uint16_t y = x >> offset; + unsigned short y = x >> offset; if (y) { x = y; return offset; @@ -36,7 +36,7 @@ inline uint8_t floor_log2_helper(uint16_t& x, size_t offset) } } -inline uint8_t floor_log2(uint16_t x) +inline size_t floor_log2(unsigned short x) { return floor_log2_helper(x, 8) + floor_log2_helper(x, 4) @@ -44,7 +44,7 @@ inline uint8_t floor_log2(uint16_t x) + floor_log2_helper(x, 1); } -inline uint8_t ceil_log2(uint16_t x) +inline size_t ceil_log2(unsigned short x) { return x > 1 ? floor_log2(x - 1) + 1 : 0; } @@ -58,16 +58,16 @@ struct LookupBlockingSizesFromTableImpl<LhsScalar, RhsScalar, true> using std::min; using std::max; typedef BlockingSizesLookupTable<LhsScalar, RhsScalar> Table; - const uint16_t minsize = Table::BaseSize; - const uint16_t maxsize = minsize << (Table::NumSizes - 1); - const uint16_t k_clamped = max<uint16_t>(minsize, min<Index>(k, maxsize)); - const uint16_t m_clamped = max<uint16_t>(minsize, min<Index>(m, maxsize)); - const uint16_t n_clamped = max<uint16_t>(minsize, min<Index>(n, maxsize)); + const unsigned short minsize = Table::BaseSize; + const unsigned short maxsize = minsize << (Table::NumSizes - 1); + const unsigned short k_clamped = max<unsigned short>(minsize, min<Index>(k, maxsize)); + const unsigned short m_clamped = max<unsigned short>(minsize, min<Index>(m, maxsize)); + const unsigned short n_clamped = max<unsigned short>(minsize, min<Index>(n, maxsize)); const size_t k_index = ceil_log2(k_clamped / minsize); const size_t m_index = ceil_log2(m_clamped / minsize); const size_t n_index = ceil_log2(n_clamped / minsize); const size_t index = n_index + Table::NumSizes * (m_index + Table::NumSizes * k_index); - const uint16_t table_entry = Table::Data()[index]; + const unsigned short table_entry = Table::Data()[index]; k = min<Index>(k, 1 << ((table_entry & 0xf00) >> 8)); m = min<Index>(m, 1 << ((table_entry & 0x0f0) >> 4)); n = min<Index>(n, 1 << ((table_entry & 0x00f) >> 0)); diff --git a/bench/analyze-blocking-sizes.cpp b/bench/analyze-blocking-sizes.cpp index 3d57f4bb3..d563a1d2d 100644 --- a/bench/analyze-blocking-sizes.cpp +++ b/bench/analyze-blocking-sizes.cpp @@ -355,8 +355,8 @@ void dump_table_for_subset( const size_t NumSizes = log2_pot(max_product_size.k / min_product_size.k) + 1; const size_t TableSize = NumSizes * NumSizes * NumSizes; cout << " static const size_t NumSizes = " << NumSizes << ";" << endl; - cout << " static const uint16_t* Data() {" << endl; - cout << " static const uint16_t data[" << TableSize << "] = {"; + cout << " static const unsigned short* Data() {" << endl; + cout << " static const unsigned short data[" << TableSize << "] = {"; while (entry_index < num_entries) { ++entry_index; if (entry_index == num_entries || |