diff options
author | Neil <unknown> | 2014-05-02 22:02:02 +1000 |
---|---|---|
committer | Neil <unknown> | 2014-05-02 22:02:02 +1000 |
commit | 20d6edd07a61856c02634971519c8519992d7346 (patch) | |
tree | 2665c0a9b559629d45b943ebc99c7353859359ec /src/PositionCache.cxx | |
parent | 566f2890290c87c5f8aaf0a47b9999d9d1956ed0 (diff) | |
download | scintilla-mirror-20d6edd07a61856c02634971519c8519992d7346.tar.gz |
Use unsigned int for calculating hash and secondary probe as overflow of signed
int is undefined in C++.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index f197a6559..820fd4895 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -594,7 +594,7 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, } } -int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) { +unsigned int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) { unsigned int ret = s[0] << 7; for (unsigned int i=0; i<len_; i++) { ret *= 1000003; @@ -652,7 +652,7 @@ void PositionCache::MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned // long comments with only a single comment. // Two way associative: try two probe positions. - int hashValue = PositionCacheEntry::Hash(styleNumber, s, len); + unsigned int hashValue = PositionCacheEntry::Hash(styleNumber, s, len); probe = static_cast<int>(hashValue % pces.size()); if (pces[probe].Retrieve(styleNumber, s, len, positions)) { return; |