diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-03-25 03:55:39 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-03-25 03:55:39 +0300 |
commit | 1064aaacbe4e7dd0571f35ef0eba3a2efc212859 (patch) | |
tree | a87e0fcc565144a675dceddbb6550991f0068d20 /moses | |
parent | cdc5e0fb33ece0a8d21af36557de8d7b9ae61509 (diff) |
delete typedefs for UINT32 and UINT64. MSVC now has uint32_t and uint64_t /Ken
Diffstat (limited to 'moses')
-rw-r--r-- | moses/File.h | 16 | ||||
-rw-r--r-- | moses/PrefixTreeMap.cpp | 12 | ||||
-rw-r--r-- | moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.cpp | 6 | ||||
-rw-r--r-- | moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h | 2 | ||||
-rw-r--r-- | moses/TypeDef.h | 9 |
5 files changed, 19 insertions, 26 deletions
diff --git a/moses/File.h b/moses/File.h index cd15165e3..fbf666ef9 100644 --- a/moses/File.h +++ b/moses/File.h @@ -57,7 +57,7 @@ template<typename T> inline void fRead(FILE* f,T& t) template<typename T> inline size_t fWrite(FILE* f,const T* b,const T* e) { - UINT32 s=std::distance(b,e); + uint32_t s=std::distance(b,e); size_t rv=fWrite(f,s); if(fwrite(b,sizeof(T),s,f)!=s) { UTIL_THROW2("ERROR: fwrite!"); @@ -67,7 +67,7 @@ template<typename T> inline size_t fWrite(FILE* f,const T* b,const T* e) template<typename T> inline size_t fWrite(FILE* f,const T b,const T e) { - UINT32 s=std::distance(b,e); + uint32_t s=std::distance(b,e); size_t rv=fWrite(f,s); if(fwrite(&(*b),sizeof(T),s,f)!=s) { UTIL_THROW2("ERROR: fwrite!"); @@ -77,7 +77,7 @@ template<typename T> inline size_t fWrite(FILE* f,const T b,const T e) template<typename C> inline size_t fWriteVector(FILE* f,const C& v) { - UINT32 s=v.size(); + uint32_t s=v.size(); size_t rv=fWrite(f,s); if(fwrite(&v[0],sizeof(typename C::value_type),s,f)!=s) { UTIL_THROW2("ERROR: fwrite!"); @@ -87,7 +87,7 @@ template<typename C> inline size_t fWriteVector(FILE* f,const C& v) template<typename C> inline void fReadVector(FILE* f, C& v) { - UINT32 s; + uint32_t s; fRead(f,s); v.resize(s); size_t r=fread(&(*v.begin()),sizeof(typename C::value_type),s,f); @@ -96,7 +96,7 @@ template<typename C> inline void fReadVector(FILE* f, C& v) } } -inline size_t fWriteString(FILE* f,const char* e, UINT32 s) +inline size_t fWriteString(FILE* f,const char* e, uint32_t s) { size_t rv=fWrite(f,s); if(fwrite(e,sizeof(char),s,f)!=s) { @@ -107,7 +107,7 @@ inline size_t fWriteString(FILE* f,const char* e, UINT32 s) inline void fReadString(FILE* f,std::string& e) { - UINT32 s; + uint32_t s; fRead(f,s); char* a=new char[s+1]; if(fread(a,sizeof(char),s,f)!=s) { @@ -120,7 +120,7 @@ inline void fReadString(FILE* f,std::string& e) inline size_t fWriteStringVector(FILE* f,const std::vector<std::string>& v) { - UINT32 s=v.size(); + uint32_t s=v.size(); size_t totrv=fWrite(f,s); for (size_t i=0; i<s; i++) { totrv+=fWriteString(f,v.at(i).c_str(),v.at(i).size()); @@ -130,7 +130,7 @@ inline size_t fWriteStringVector(FILE* f,const std::vector<std::string>& v) inline void fReadStringVector(FILE* f, std::vector<std::string>& v) { - UINT32 s; + uint32_t s; fRead(f,s); v.resize(s); diff --git a/moses/PrefixTreeMap.cpp b/moses/PrefixTreeMap.cpp index 1719ebdba..fc51899f3 100644 --- a/moses/PrefixTreeMap.cpp +++ b/moses/PrefixTreeMap.cpp @@ -13,14 +13,14 @@ void GenericCandidate::readBin(FILE* f) { m_PhraseList.clear(); m_ScoreList.clear(); - UINT32 num_phrases; // on older compilers, <stdint.h> may need to be included + uint32_t num_phrases; // on older compilers, <stdint.h> may need to be included fRead(f, num_phrases); for(unsigned int i = 0; i < num_phrases; ++i) { IPhrase phrase; fReadVector(f, phrase); m_PhraseList.push_back(phrase); }; - UINT32 num_scores; + uint32_t num_scores; fRead(f, num_scores); for(unsigned int j = 0; j < num_scores; ++j) { std::vector<float> score; @@ -32,11 +32,11 @@ void GenericCandidate::readBin(FILE* f) void GenericCandidate::writeBin(FILE* f) const { // cast is necessary to ensure compatibility between 32- and 64-bit platforms - fWrite(f, static_cast<UINT32>(m_PhraseList.size())); + fWrite(f, static_cast<uint32_t>(m_PhraseList.size())); for(size_t i = 0; i < m_PhraseList.size(); ++i) { fWriteVector(f, m_PhraseList[i]); } - fWrite(f, static_cast<UINT32>(m_ScoreList.size())); + fWrite(f, static_cast<uint32_t>(m_ScoreList.size())); for(size_t j = 0; j < m_ScoreList.size(); ++j) { fWriteVector(f, m_ScoreList[j]); } @@ -45,7 +45,7 @@ void GenericCandidate::writeBin(FILE* f) const void Candidates::writeBin(FILE* f) const { - UINT32 s = this->size(); + uint32_t s = this->size(); fWrite(f,s); for(size_t i = 0; i < s; ++i) { MyBase::operator[](i).writeBin(f); @@ -54,7 +54,7 @@ void Candidates::writeBin(FILE* f) const void Candidates::readBin(FILE* f) { - UINT32 s; + uint32_t s; fRead(f,s); this->resize(s); for(size_t i = 0; i<s; ++i) { diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.cpp b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.cpp index 77678e523..349fc4cbc 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.cpp +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.cpp @@ -64,7 +64,7 @@ ChartRuleLookupManagerOnDisk::ChartRuleLookupManagerOnDisk( ChartRuleLookupManagerOnDisk::~ChartRuleLookupManagerOnDisk() { - std::map<UINT64, const TargetPhraseCollection*>::const_iterator iterCache; + std::map<uint64_t, const TargetPhraseCollection*>::const_iterator iterCache; for (iterCache = m_cache.begin(); iterCache != m_cache.end(); ++iterCache) { delete iterCache->second; } @@ -239,8 +239,8 @@ void ChartRuleLookupManagerOnDisk::GetChartRuleCollection( const TargetPhraseCollection *targetPhraseCollection = NULL; const OnDiskPt::PhraseNode *node = prevNode.GetChild(*sourceLHSBerkeleyDb, m_dbWrapper); if (node) { - UINT64 tpCollFilePos = node->GetValue(); - std::map<UINT64, const TargetPhraseCollection*>::const_iterator iterCache = m_cache.find(tpCollFilePos); + uint64_t tpCollFilePos = node->GetValue(); + std::map<uint64_t, const TargetPhraseCollection*>::const_iterator iterCache = m_cache.find(tpCollFilePos); if (iterCache == m_cache.end()) { const OnDiskPt::TargetPhraseCollection *tpcollBerkeleyDb = node->GetTargetPhraseCollection(m_dictionary.GetTableLimit(), m_dbWrapper); diff --git a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h index 0ff87b378..42cbdcc46 100644 --- a/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h +++ b/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h @@ -55,7 +55,7 @@ private: const std::vector<FactorType> &m_inputFactorsVec; const std::vector<FactorType> &m_outputFactorsVec; std::vector<DottedRuleStackOnDisk*> m_expandableDottedRuleListVec; - std::map<UINT64, const TargetPhraseCollection*> m_cache; + std::map<uint64_t, const TargetPhraseCollection*> m_cache; std::list<const OnDiskPt::PhraseNode*> m_sourcePhraseNode; }; diff --git a/moses/TypeDef.h b/moses/TypeDef.h index 59cb91499..a47a6e2fe 100644 --- a/moses/TypeDef.h +++ b/moses/TypeDef.h @@ -23,17 +23,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include <limits> #include <vector> #include <string> +#include <stdint.h> //! all the typedefs and enums goes here -#ifdef WIN32 -#include <BaseTsd.h> -#else -#include <stdint.h> - -typedef uint32_t UINT32; -typedef uint64_t UINT64; -#endif namespace Moses { |