summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-04 13:59:58 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-01-04 14:47:18 +0000
commitc8597274c31ed2ba59b5f2c6f555099aa9928f39 (patch)
tree160c58cff07e45a01a5c58327b673207efe3db81
parentd279115a14faab0005c4dd20e2b2be43a4849b18 (diff)
merge OpCodeEnum and OpCode
and replace ifdef hackery with an explicit underlying type Change-Id: Ibd340cf28d022af545a82e98e623d4c137ff7e53
-rw-r--r--include/formula/opcode.hxx10
-rw-r--r--sc/inc/calcconfig.hxx2
-rw-r--r--sc/inc/formulagroup.hxx2
-rw-r--r--sc/source/core/tool/calcconfig.cxx4
-rw-r--r--sc/source/core/tool/formulagroup.cxx2
-rw-r--r--sc/source/core/tool/token.cxx4
6 files changed, 8 insertions, 16 deletions
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 199d598c5638..0626ed5181db 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -23,7 +23,7 @@
#include <formula/compiler.hrc>
#include <sal/types.h>
-enum OpCodeEnum
+enum OpCode : sal_uInt16
{
// Special commands
ocPush = SC_OPCODE_PUSH,
@@ -475,14 +475,6 @@ enum OpCodeEnum
ocNone = SC_OPCODE_NONE
};
-#ifndef DBG_UTIL
-// save memory since compilers tend to int an enum
-typedef sal_uInt16 OpCode;
-#else
-// have enum names in debugger
-typedef OpCodeEnum OpCode;
-#endif
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 1477134511de..7cc8fadcc7d0 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -49,7 +49,7 @@ struct SC_DLLPUBLIC ScCalcConfig
OUString maOpenCLDevice;
sal_Int32 mnOpenCLMinimumFormulaGroupSize;
- typedef std::set<OpCodeEnum> OpCodeSet;
+ typedef std::set<OpCode> OpCodeSet;
OpCodeSet maOpenCLSubsetOpCodes;
diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 191b78e36c6c..ba553c600eaf 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -129,7 +129,7 @@ class SC_DLLPUBLIC FormulaGroupInterpreter
#if HAVE_FEATURE_OPENCL
static void fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms);
static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation = false);
- static void enableOpenCL(bool bEnable, bool bEnableCompletely = false, const std::set<OpCodeEnum>& rSubsetToEnable = std::set<OpCodeEnum>());
+ static void enableOpenCL(bool bEnable, bool bEnableCompletely = false, const std::set<OpCode>& rSubsetToEnable = std::set<OpCode>());
static void getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int32& rPlatformId);
#endif
virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0;
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 91ae7e5676a2..3e00b059a213 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -184,12 +184,12 @@ ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes)
OUString element(s.copy(fromIndex, semicolon - fromIndex));
sal_Int32 n = element.toInt32();
if (n > 0 || (n == 0 && element == "0"))
- result.insert(static_cast<OpCodeEnum>(n));
+ result.insert(static_cast<OpCode>(n));
else if (pHashMap)
{
auto opcode(pHashMap->find(element));
if (opcode != pHashMap->end())
- result.insert(static_cast<OpCodeEnum>(opcode->second));
+ result.insert(static_cast<OpCode>(opcode->second));
else
SAL_WARN("sc.opencl", "Unrecognized OpCode " << element << " in OpCode set string");
}
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 870c06a8a6ad..68e988123f75 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -547,7 +547,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
rPlatformId = aPlatformId;
}
-void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely, const std::set<OpCodeEnum>& rSubsetToEnable)
+void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely, const std::set<OpCode>& rSubsetToEnable)
{
boost::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
officecfg::Office::Common::Misc::UseOpenCL::set(bEnable, batch);
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ebfb8ca3834f..cd9e656358dd 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -1141,7 +1141,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
if (SC_OPCODE_START_FUNCTION <= eOp && eOp < SC_OPCODE_STOP_FUNCTION)
{
- if (ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly && ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.find(static_cast<OpCodeEnum>(eOp)) == ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.end())
+ if (ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly && ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.find(eOp) == ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.end())
{
meVectorState = FormulaVectorDisabled;
return;
@@ -1382,7 +1382,7 @@ void ScTokenArray::CheckToken( const FormulaToken& r )
if (eOp >= SC_OPCODE_START_BIN_OP &&
eOp <= SC_OPCODE_STOP_UN_OP &&
ScInterpreter::GetGlobalConfig().mbOpenCLSubsetOnly &&
- ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.find(static_cast<OpCodeEnum>(eOp)) == ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.end())
+ ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.find(eOp) == ScInterpreter::GetGlobalConfig().maOpenCLSubsetOpCodes.end())
{
meVectorState = FormulaVectorDisabled;
return;