[Libreoffice-commits] core.git: include/formula sc/inc sc/source

Caolán McNamara caolanm at redhat.com
Sun Jan 4 06:47:44 PST 2015


 include/formula/opcode.hxx           |   10 +---------
 sc/inc/calcconfig.hxx                |    2 +-
 sc/inc/formulagroup.hxx              |    2 +-
 sc/source/core/tool/calcconfig.cxx   |    4 ++--
 sc/source/core/tool/formulagroup.cxx |    2 +-
 sc/source/core/tool/token.cxx        |    4 ++--
 6 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit c8597274c31ed2ba59b5f2c6f555099aa9928f39
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 4 13:59:58 2015 +0000

    merge OpCodeEnum and OpCode
    
    and replace ifdef hackery with an explicit underlying type
    
    Change-Id: Ibd340cf28d022af545a82e98e623d4c137ff7e53

diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 199d598..0626ed5 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 1477134..7cc8fad 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 191b78e..ba553c6 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 91ae7e5..3e00b05 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 870c06a..68e9881 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 ebfb8ca..cd9e656 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;


More information about the Libreoffice-commits mailing list