summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-19 09:40:43 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-19 13:40:26 -0400
commit290d192a9e7f1877b08537da379d09a8a557c94f (patch)
tree58e16e888f84eca79a546f94f88f1258cbd1ef55 /sc
parent5a637138c0271357619629947e9cc6f90de2c03a (diff)
Tweak hash generation code to NOT rely on 'i' to shift bits.
Because 'i' can get very large. Change-Id: I1c7fcafaa60b14f709861f32c56defc7bcaee451
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/token.cxx31
1 files changed, 17 insertions, 14 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 6368ba71ca46..85d6e9a6e0ab 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1386,45 +1386,48 @@ void ScTokenArray::GenHash()
{
// Constant value.
sal_uInt8 nVal = p->GetByte();
- nHash += (static_cast<size_t>(nVal) << i);
- continue;
+ nHash += static_cast<size_t>(nVal);
}
+ break;
case svDouble:
{
// Constant value.
double fVal = p->GetDouble();
- nHash += (static_cast<size_t>(fVal) << i);
- continue;
+ nHash += static_cast<size_t>(fVal);
}
+ break;
case svString:
{
// Constant string.
const String& rStr = p->GetString();
- nHash += (aHasher(rStr) << i);
- continue;
+ nHash += aHasher(rStr);
}
+ break;
case svSingleRef:
{
size_t nVal = HashSingleRef(p->GetSingleRef());
- nHash += (nVal << i);
- continue;
+ nHash += nVal;
}
+ break;
case svDoubleRef:
{
const ScComplexRefData& rRef = p->GetDoubleRef();
size_t nVal1 = HashSingleRef(rRef.Ref1);
size_t nVal2 = HashSingleRef(rRef.Ref2);
- nHash += (nVal1 << i);
- nHash += (nVal2 << i);
- continue;
+ nHash += nVal1;
+ nHash += nVal2;
}
+ break;
default:
- ;
+ // Use the opcode value in all the other cases.
+ nHash += static_cast<size_t>(eOp);
}
}
+ else
+ // Use the opcode value in all the other cases.
+ nHash += static_cast<size_t>(eOp);
- // Use the opcode value in all the other cases.
- nHash += (static_cast<size_t>(eOp) << i);
+ nHash = (nHash << 4) - nHash;
}
mnHashValue = nHash;