-
Enhancement
-
Resolution: Unresolved
-
P4
-
24
This came up with the memory segment API:
int sum = 0;
for (int i = 0; i < segment.byteSize(); i++) {
sum += segment.get(JAVA_BYTE, i);
}
is not recognize as counted loop because segment.byteSize() is a long and the comparison really is:
(long)i < segment.byteSize()
We'd like this to be converted to:
i < (int)segment.byteSize()
which is only possible if segment.byteSize() fits an int.
int sum = 0;
for (int i = 0; i < segment.byteSize(); i++) {
sum += segment.get(JAVA_BYTE, i);
}
is not recognize as counted loop because segment.byteSize() is a long and the comparison really is:
(long)i < segment.byteSize()
We'd like this to be converted to:
i < (int)segment.byteSize()
which is only possible if segment.byteSize() fits an int.
- links to
-
Review(master) openjdk/jdk/22449