src/java.base/share/native/libjava/Bits.c
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/java.base/share/native/libjava/Bits.c	Mon Jan 25 20:47:21 2016
--- new/src/java.base/share/native/libjava/Bits.c	Mon Jan 25 20:47:21 2016

*** 56,80 **** --- 56,82 ---- Java_java_nio_Bits_copyFromShortArray(JNIEnv *env, jclass clazz, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; size_t size; - jshort *srcShort, *dstShort, *endShort; ! jshort tmpShort; ! unsigned char* dst; ! dstShort = (jshort *)jlong_to_ptr(dstAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, src); srcShort = (jshort *)(bytes + srcPos); ! endShort = srcShort + (size / sizeof(jshort)); ! endShort = (jshort *)(bytes + srcPos + size); while (srcShort < endShort) { ! tmpShort = *srcShort++; ! *dstShort++ = SWAPSHORT(tmpShort); ! jshort tmp = SWAPSHORT(*srcShort); ! memcpy(dst, &tmp, sizeof(jshort)); + srcShort++; + dst += sizeof(jshort); } RELEASECRITICAL(bytes, env, src, JNI_ABORT); length -= size;
*** 86,110 **** --- 88,114 ---- Java_java_nio_Bits_copyToShortArray(JNIEnv *env, jclass clazz, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; size_t size; ! jshort *srcShort, *dstShort, *endShort; jshort tmpShort; ! srcShort = (jshort *)jlong_to_ptr(srcAddr); ! unsigned char *src, *end; + src = jlong_to_ptr(srcAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, dst); dstShort = (jshort *)(bytes + dstPos); ! endShort = srcShort + (size / sizeof(jshort)); ! while (srcShort < endShort) { ! tmpShort = *srcShort++; ! *dstShort++ = SWAPSHORT(tmpShort); ! end = src + size; ! while (src < end) { ! jshort tmp; ! memcpy(&tmp, src, sizeof(jshort)); + *dstShort++ = SWAPSHORT(tmp); + src += sizeof(jshort); } RELEASECRITICAL(bytes, env, dst, 0); length -= size;
*** 116,140 **** --- 120,146 ---- Java_java_nio_Bits_copyFromIntArray(JNIEnv *env, jclass clazz, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; size_t size; - jint *srcInt, *dstInt, *endInt; ! jint tmpInt; ! unsigned char *dst; ! dstInt = (jint *)jlong_to_ptr(dstAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, src); srcInt = (jint *)(bytes + srcPos); ! endInt = srcInt + (size / sizeof(jint)); ! endInt = (jint *)(bytes + srcPos + size); while (srcInt < endInt) { ! tmpInt = *srcInt++; ! *dstInt++ = SWAPINT(tmpInt); ! jint tmp = SWAPINT(*srcInt); ! memcpy(dst, &tmp, sizeof(jint)); + srcInt++; + dst += sizeof(jint); } RELEASECRITICAL(bytes, env, src, JNI_ABORT); length -= size;
*** 146,170 **** --- 152,178 ---- Java_java_nio_Bits_copyToIntArray(JNIEnv *env, jclass clazz, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; size_t size; ! jint *srcInt, *dstInt, *endInt; ! jint tmpInt; ! unsigned char *src, *end; ! jint *dstInt; ! srcInt = (jint *)jlong_to_ptr(srcAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, dst); dstInt = (jint *)(bytes + dstPos); ! endInt = srcInt + (size / sizeof(jint)); ! while (srcInt < endInt) { ! tmpInt = *srcInt++; ! *dstInt++ = SWAPINT(tmpInt); ! end = src + size; ! while (src < end) { ! jint tmp; ! memcpy(&tmp, src, sizeof(jint)); + *dstInt++ = SWAPINT(tmp); + src += sizeof(jint); } RELEASECRITICAL(bytes, env, dst, 0); length -= size;
*** 176,200 **** --- 184,210 ---- Java_java_nio_Bits_copyFromLongArray(JNIEnv *env, jclass clazz, jobject src, jlong srcPos, jlong dstAddr, jlong length) { jbyte *bytes; size_t size; - jlong *srcLong, *dstLong, *endLong; ! jlong tmpLong; ! unsigned char* dst; ! dstLong = (jlong *)jlong_to_ptr(dstAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, src); srcLong = (jlong *)(bytes + srcPos); ! endLong = srcLong + (size / sizeof(jlong)); ! endLong = (jlong *)(bytes + srcPos + size); while (srcLong < endLong) { ! tmpLong = *srcLong++; ! *dstLong++ = SWAPLONG(tmpLong); ! jlong tmp = SWAPLONG(*srcLong); ! memcpy(dst, &tmp, sizeof(jlong)); + srcLong++; + dst += sizeof(jlong); } RELEASECRITICAL(bytes, env, src, JNI_ABORT); length -= size;
*** 206,230 **** --- 216,242 ---- Java_java_nio_Bits_copyToLongArray(JNIEnv *env, jclass clazz, jlong srcAddr, jobject dst, jlong dstPos, jlong length) { jbyte *bytes; size_t size; ! jlong *srcLong, *dstLong, *endLong; ! jlong tmpLong; ! unsigned char *src, *end; ! jlong *dstLong; ! srcLong = (jlong *)jlong_to_ptr(srcAddr); while (length > 0) { size = (length < MBYTE) ? (size_t)length : (size_t)MBYTE; GETCRITICAL_OR_RETURN(bytes, env, dst); dstLong = (jlong *)(bytes + dstPos); ! endLong = srcLong + (size / sizeof(jlong)); ! while (srcLong < endLong) { ! tmpLong = *srcLong++; ! *dstLong++ = SWAPLONG(tmpLong); ! end = src + size; ! while (src < end) { ! jlong tmp; ! memcpy(&tmp, src, sizeof(jlong)); + *dstLong++ = SWAPLONG(tmp); + src += sizeof(jlong); } RELEASECRITICAL(bytes, env, dst, 0); length -= size;

src/java.base/share/native/libjava/Bits.c
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File