-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Static analysis (MSVC) fixes for device_buffer_utils.h #7904
Conversation
src/runtime/device_buffer_utils.h
Outdated
@@ -89,7 +93,7 @@ WEAK device_copy make_buffer_copy(const halide_buffer_t *src, bool src_host, | |||
// Offset the src base pointer to the right point in its buffer. | |||
c.src_begin = 0; | |||
for (int i = 0; i < src->dimensions; i++) { | |||
c.src_begin += (uint64_t)src->dim[i].stride * (dst->dim[i].min - src->dim[i].min); | |||
c.src_begin += (uint64_t)src->dim[i].stride * (uint64_t)(dst->dim[i].min - src->dim[i].min); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be uint or int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point... Are strides allowed to be negative too (to move "backward", in order to represent bottom-left origin images and such)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed both casts to (int64_t)
to be consistent with the other similar casts in the same file.
Build-bot failures appear to be unrelated. |
* Static analysis (MSVC) fixes for device_buffer_utils.h * clang-format happiness * signed integer cast
Preventing things like: