RFR 8074067: Cleanup in java.base/share/native/libjava/Bits.c

Ivan Gerasimov ivan.gerasimov at oracle.com
Tue Mar 3 18:39:40 UTC 2015



On 03.03.2015 12:23, Martin Buchholz wrote:
>
>
> On Tue, Mar 3, 2015 at 12:15 AM, Ivan Gerasimov 
> <ivan.gerasimov at oracle.com <mailto:ivan.gerasimov at oracle.com>> wrote:
>
>     Thanks Martin for the suggestion!
>
>     On 03.03.2015 0:08, Martin Buchholz wrote:
>>     slightly safer (more likely to compile everywhere) might be to
>>     convert input length into a size_t immediately and to
>>
>     I'm not quite sure it would be correct.
>     If size_t happens to be 32-bit int, then the length could
>     overflow, since it represents the size of the array in bytes,
>     while we're operating on the the array of shorts, ints and longs.
>     I would feel more comfortable if length gets cast to size_t only
>     when it is guaranteed to be in the range (0, 1048576).
>
>
> Sounds good to me!
> It's still good practice to have both branches of a ternary expression 
> have the same signedness.
>
Okay. But I don't want to make MBYTE unsigned, or we'll have '/comparing 
signed to unsigned/' compile-time warning.

> BTW, it seems those static native methods like copyFromShortArray 
> should have a jclass clazz second arg, not a jobject this.
Cool! I'll include fixing that too.

http://cr.openjdk.java.net/~igerasim/8074067/2/webrev/src/java.base/share/native/libjava/Bits.c.sdiff.html

Sincerely yours,
Ivan





More information about the core-libs-dev mailing list