Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct float literals, 32/64 trunc, unref vars #268

Merged
merged 1 commit into from
Nov 20, 2021

Conversation

diablodale
Copy link
Contributor

The depthai-core portion of fixes for #248

Together with the already merged depthai-shared portion, they eliminate hundreds of warnings to lessen noise.

Copy link
Collaborator

@SzabolcsGergely SzabolcsGergely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing due to style checks.
clangformat target should solve it, but I assume you don't have it installed on windows?

@diablodale
Copy link
Contributor Author

It is enabled in cmake, but such isn't available in typical Windows installations so cmake it likely quietly ignoring that target.

Alternatively, I used the VSCode c++ extension from Microsoft and have enabled. It does apply clang-format when I type a semicolon. But in many of these, I never typed a semi...I just inserted the casts inside the line. So it never formatted.
I del/add a semi on one of the lines lang-format reported and it reformatted it in the same way as the CI report.

I've turned on the additional option to clang-format on save of the file. Makes me a bit paranoid because I'll likely not notice the reformatting, but I get your team's need for this and I can work with that.
I'll resave the two files that the CI reported wrong and force push.

That all ok with u?

@SzabolcsGergely
Copy link
Collaborator

It is enabled in cmake, but such isn't available in typical Windows installations so cmake it likely quietly ignoring that target.

Alternatively, I used the VSCode c++ extension from Microsoft and have enabled. It does apply clang-format when I type a semicolon. But in many of these, I never typed a semi...I just inserted the casts inside the line. So it never formatted. I del/add a semi on one of the lines lang-format reported and it reformatted it in the same way as the CI report.

I've turned on the additional option to clang-format on save of the file. Makes me a bit paranoid because I'll likely not notice the reformatting, but I get your team's need for this and I can work with that. I'll resave the two files that the CI reported wrong and force push.

That all ok with u?

Yes, that's fine.

@diablodale
Copy link
Contributor Author

🤔 the CI here isn't getting the forcepush I did. Its available at https://github.com/diablodale/depthai-core/tree/fix248-trunc-2 but it isn't showing up on the tabs here (and therefore not reprocessing it)

@themarpe
Copy link
Collaborator

Reran the checks - will merge afterwards 👍

@SzabolcsGergely SzabolcsGergely merged commit 0284841 into luxonis:develop Nov 20, 2021
@@ -136,8 +136,8 @@ bool matInv(std::vector<std::vector<float>>& A, std::vector<std::vector<float>>&

std::vector<float> temp;
// Find Inverse using formula "inverse(A) = adj(A)/det(A)"
for(size_t i = 0; i < A.size(); i++) {
for(size_t j = 0; j < A.size(); j++) {
for(size_t i = 0; i < A.size(); ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious on the i++ -> ++i changes, were there any warnings triggered by the previous version, or it's more like a style preference?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Porbably style, pre-increment is faster than post-increment, theoretically, but not for POD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre is my preferred for best opportunity for optimization, see notes https://en.cppreference.com/w/cpp/language/operator_incdec
No guarantee compilers old/new on all platforms won't use the slow path on POD. So I prefer pre.

I did not do it everywhere i that matrix code as some places need the post behavior.

FYI, the Eigen library is fantastically excellent and all header. Even for light use like cali processing. They've been testing and optimizing across years and more platforms than most anyone could redo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants