Open
Conversation
…"rank" variable in sizeOptimizer
…of double free in sizeOptimizer
…of the crop case in optimizeXYZ_3D
DStrelak
requested changes
Jul 10, 2019
| class GeneralTransform { | ||
| public: | ||
|
|
||
| enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 }; |
sizeOptimizer.cpp
Outdated
| std::vector<GeneralTransform> *tmp = | ||
| optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop); | ||
| std::vector<GeneralTransform> *tmp; | ||
| if(rank == 3){ |
| optimizeXYZ(in, nBest, maxPercIncrease, squareOnly, crop); | ||
| std::vector<GeneralTransform> *tmp; | ||
| if(rank == 3){ | ||
| tmp = optimizeXYZ_3D(in, nBest, maxPercIncrease, squareOnly, crop); |
Member
There was a problem hiding this comment.
no need to decide here. Check it within the optimizeXYZ (and call appropriate version there)
sizeOptimizer.cpp
Outdated
| std::vector<Polynom> *polysX = generatePolys(tr.X, tr.isFloat, crop); | ||
| if(!crop){ | ||
| std::sort (polysX->begin(), polysX->end()); | ||
| }else{ |
| } else if (tr.Y == tr.Z) { | ||
| polysZ = polysY; | ||
| } else { | ||
| polysZ = generatePolys(tr.Z, tr.isFloat, crop); |
Member
There was a problem hiding this comment.
repetitive code, please extract helper method
sizeOptimizer.cpp
Outdated
| size_t found = 0; | ||
| for (auto& x : *polysX) { | ||
| for (auto& y : *polysY) { | ||
| if (squareOnly && (x.value != y.value) && (y.value != 1)) continue; |
Member
There was a problem hiding this comment.
In 3D case, x and y should never be == 1
| } | ||
|
|
||
| std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ(GeneralTransform &tr, | ||
| std::vector<GeneralTransform> *SizeOptimizer::optimizeXYZ_3D(GeneralTransform &tr, |
Member
There was a problem hiding this comment.
It seems to me that the only difference to 1D/2D case is filtering vs sorting.
Is it true?
If so, pass filtering/sorting method to general
template
optimizeXYZ(..., G &generator)
sizeOptimizer.h
Outdated
|
|
||
| int getInvocations(Polynom &poly, bool isFloat); | ||
| int getInvocationsV8(Polynom &poly, bool isFloat); | ||
| std::vector<Polynom> *cutN(std::vector<Polynom>* polys , size_t nBest); |
DStrelak
reviewed
Jul 10, 2019
| class GeneralTransform { | ||
| public: | ||
|
|
||
| enum Rank { RANK_1D = 1, RANK_2D = 2, RANK_3D = 3 }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.