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

Fix warning about order of operations in ternary #2374

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion vowpalwabbit/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3020,7 +3020,7 @@ action search::predictLDF(example* ecs, size_t ec_cnt, ptag mytag, const action*
// action "1" is at index 0. Map action to its appropriate index. In particular, this fixes an
// issue where the predicted action is the last, and there is no example header, causing an index
// beyond the end of the array (usually resulting in a segfault at some point.)
size_t action_index = a - COST_SENSITIVE::ec_is_example_header(ecs[0]) ? 0 : 1;
size_t action_index = a - (COST_SENSITIVE::ec_is_example_header(ecs[0]) ? 0 : 1);

if ((mytag != 0) && ecs[action_index].l.cs.costs.size() > 0)
{
Expand Down