From 660934a977cb69a2de271a4990de97e0cfc57e66 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sun, 30 May 2021 15:37:59 +0200 Subject: [PATCH] review --- .gitignore | 1 + sources/SQM-GUI-ng.pro.user | 63 +++--- sources/SQM-GUI-ng.pro.user.500a65f | 322 ++++++++++++++++++++++++++++ sources/sqmtablemodel.cpp | 24 +-- sources/sqmtablemodel.h | 1 - 5 files changed, 357 insertions(+), 54 deletions(-) create mode 100644 .gitignore create mode 100644 sources/SQM-GUI-ng.pro.user.500a65f diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1b2211d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build* diff --git a/sources/SQM-GUI-ng.pro.user b/sources/SQM-GUI-ng.pro.user index af7ad80..e997600 100644 --- a/sources/SQM-GUI-ng.pro.user +++ b/sources/SQM-GUI-ng.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {500a65f7-9d99-4e4c-94ca-f6a1a717d58b} + {b374307c-284e-4a61-8f4d-72586b602ecf} ProjectExplorer.Project.ActiveTarget @@ -70,16 +70,14 @@ 0 true - - -fno-delayed-template-parsing - + true Builtin.BuildSystem true true Builtin.DefaultTidyAndClazy - 8 + 2 @@ -91,16 +89,16 @@ ProjectExplorer.Project.Target.0 Desktop - Desktop Qt 6.1.0 MinGW 64-bit - Desktop Qt 6.1.0 MinGW 64-bit - qt.qt6.610.win64_mingw81_kit + Desktop Qt 5.15.2 GCC 64bit + Desktop Qt 5.15.2 GCC 64bit + qt.qt5.5152.gcc_64_kit 0 0 0 0 - C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug - C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Debug + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Debug true @@ -113,8 +111,8 @@ Qt4ProjectManager.MakeStep 2 - Erstellen - Erstellen + Build + Build ProjectExplorer.BuildSteps.Build @@ -124,8 +122,8 @@ clean 1 - Bereinigen - Bereinigen + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -137,8 +135,8 @@ 2 - C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Release - C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Release + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Release + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Release true @@ -151,8 +149,8 @@ Qt4ProjectManager.MakeStep 2 - Erstellen - Erstellen + Build + Build ProjectExplorer.BuildSteps.Build @@ -162,8 +160,8 @@ clean 1 - Bereinigen - Bereinigen + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -177,8 +175,8 @@ 0 - C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Profile - C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Profile + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Profile + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Profile true @@ -191,8 +189,8 @@ Qt4ProjectManager.MakeStep 2 - Erstellen - Erstellen + Build + Build ProjectExplorer.BuildSteps.Build @@ -202,8 +200,8 @@ clean 1 - Bereinigen - Bereinigen + Clean + Clean ProjectExplorer.BuildSteps.Clean 2 @@ -220,8 +218,8 @@ 0 - Deployment - Deployment + Deploy + Deploy ProjectExplorer.BuildSteps.Deploy 1 @@ -294,15 +292,14 @@ 2 - SQM-GUI-ng2 - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro - C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/wn/Workspaces/fuer_matti/sqm-gui/sources/SQM-GUI-ng.pro + /home/wn/Workspaces/fuer_matti/sqm-gui/sources/SQM-GUI-ng.pro false true true false true - C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug + /home/wn/Workspaces/fuer_matti/sqm-gui/build-SQM-GUI-ng-Desktop_Qt_5_15_2_GCC_64bit-Debug 1 diff --git a/sources/SQM-GUI-ng.pro.user.500a65f b/sources/SQM-GUI-ng.pro.user.500a65f new file mode 100644 index 0000000..af7ad80 --- /dev/null +++ b/sources/SQM-GUI-ng.pro.user.500a65f @@ -0,0 +1,322 @@ + + + + + + EnvironmentId + {500a65f7-9d99-4e4c-94ca-f6a1a717d58b} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + -fno-delayed-template-parsing + + true + Builtin.BuildSystem + + true + true + Builtin.DefaultTidyAndClazy + 8 + + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop Qt 6.1.0 MinGW 64-bit + Desktop Qt 6.1.0 MinGW 64-bit + qt.qt6.610.win64_mingw81_kit + 0 + 0 + 0 + + 0 + C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug + C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Erstellen + Erstellen + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Bereinigen + Bereinigen + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Release + C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Erstellen + Erstellen + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Bereinigen + Bereinigen + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + C:\Users\matth\Documents\build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Profile + C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Erstellen + Erstellen + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Bereinigen + Bereinigen + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deployment + Deployment + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + + 25 + + 1 + true + false + true + + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + SQM-GUI-ng2 + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro + C:/Users/matth/Documents/Workspace/MPI/sqm-gui/sources/SQM-GUI-ng.pro + false + true + true + false + true + C:/Users/matth/Documents/build-SQM-GUI-ng-Desktop_Qt_6_1_0_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/sources/sqmtablemodel.cpp b/sources/sqmtablemodel.cpp index 0cd3e1c..ba4cf13 100644 --- a/sources/sqmtablemodel.cpp +++ b/sources/sqmtablemodel.cpp @@ -101,31 +101,15 @@ void SQMTableModel::SetStartValues(int pBase, int pExp, int pMod) { } -// Convert int to binary -std::string SQMTableModel::IntToBinary(int n) { - string bin; - int mask = 1; - while (n != 0) { - bin += (n & mask) == 0 ? "0" : "1"; - n = n >> 1; - } - - reverse(bin.begin(), bin.end()); - return bin; -} - void SQMTableModel::CalculateSqmMatrix() { // Clear sqmMatrix sqmMatrix.clear(); - // Calculate binary of exponent - string bin = IntToBinary(exp); - binLen = bin.length(); - - // Init BIN Column + binLen = 0; vector colBin; - for (int i = 0; i < binLen; i++) { - colBin.push_back(bin[i] - '0'); + while ((1 << binLen) < exp) { + colBin.push_back((exp >> binLen) & 1); + binLen += 1; } // Add or remove rows diff --git a/sources/sqmtablemodel.h b/sources/sqmtablemodel.h index 2d3dec3..7bf73fc 100644 --- a/sources/sqmtablemodel.h +++ b/sources/sqmtablemodel.h @@ -19,7 +19,6 @@ public: void SetStartValues(int pBase, int pExp, int pMod); private: - std::string IntToBinary(int n); void CalculateSqmMatrix(); void UpdateSqmMatrix(QModelIndex startIndex);