@@ -66,9 +66,22 @@ static void copyInt8Buffer(JNIEnv *env, jobject obj, jlong pointer, jbyteArray d
6666 env->SetByteArrayRegion (destination, start, length, buffer);
6767}
6868
69- static void copyUInt16Buffer (JNIEnv *env, jobject obj, jlong pointer, jintArray destination, jint start, jint length)
69+ static void copyInt32Buffer (JNIEnv *env, jobject obj, jlong pointer, jfloatArray destination, jint start, jint length, jfloat scale )
7070{
71- uint16_t *buffer = reinterpret_cast <uint16_t *>(pointer);
71+ int32_t *buffer = reinterpret_cast <int32_t *>(pointer);
72+ void *raw = env->GetPrimitiveArrayCritical (destination, nullptr );
73+ jfloat *values = static_cast <jfloat *>(raw) + start;
74+
75+ for (jint i = 0 ; i < length; i++) {
76+ values[i] = buffer[i] * scale;
77+ }
78+
79+ env->ReleasePrimitiveArrayCritical (destination, raw, 0 );
80+ }
81+
82+ static void copyUInt8Buffer (JNIEnv *env, jobject obj, jlong pointer, jintArray destination, jint start, jint length)
83+ {
84+ uint8_t *buffer = reinterpret_cast <uint8_t *>(pointer);
7285 void *raw = env->GetPrimitiveArrayCritical (destination, nullptr );
7386 jint *values = static_cast <jint *>(raw) + start;
7487
@@ -79,9 +92,9 @@ static void copyUInt16Buffer(JNIEnv *env, jobject obj, jlong pointer, jintArray
7992 env->ReleasePrimitiveArrayCritical (destination, raw, 0 );
8093}
8194
82- static void copyUIntPtrBuffer (JNIEnv *env, jobject obj, jlong pointer, jintArray destination, jint start, jint length)
95+ static void copyUInt16Buffer (JNIEnv *env, jobject obj, jlong pointer, jintArray destination, jint start, jint length)
8396{
84- size_t *buffer = reinterpret_cast <size_t *>(pointer);
97+ uint16_t *buffer = reinterpret_cast <uint16_t *>(pointer);
8598 void *raw = env->GetPrimitiveArrayCritical (destination, nullptr );
8699 jint *values = static_cast <jint *>(raw) + start;
87100
@@ -92,14 +105,14 @@ static void copyUIntPtrBuffer(JNIEnv *env, jobject obj, jlong pointer, jintArray
92105 env->ReleasePrimitiveArrayCritical (destination, raw, 0 );
93106}
94107
95- static void copyInt32Buffer (JNIEnv *env, jobject obj, jlong pointer, jfloatArray destination, jint start, jint length, jfloat scale )
108+ static void copyUIntPtrBuffer (JNIEnv *env, jobject obj, jlong pointer, jintArray destination, jint start, jint length)
96109{
97- int32_t *buffer = reinterpret_cast <int32_t *>(pointer);
110+ size_t *buffer = reinterpret_cast <size_t *>(pointer);
98111 void *raw = env->GetPrimitiveArrayCritical (destination, nullptr );
99- jfloat *values = static_cast <jfloat *>(raw) + start;
112+ jint *values = static_cast <jint *>(raw) + start;
100113
101114 for (jint i = 0 ; i < length; i++) {
102- values[i] = buffer[i] * scale ;
115+ values[i] = static_cast <jint>( buffer[i]) ;
103116 }
104117
105118 env->ReleasePrimitiveArrayCritical (destination, raw, 0 );
@@ -112,9 +125,10 @@ static JNINativeMethod JNI_METHODS[] = {
112125 { " getInt32Value" , " (J)I" , (void *)getInt32Value },
113126 { " getIntPtrValue" , " (J)J" , (void *)getIntPtrValue },
114127 { " copyInt8Buffer" , " (J[BII)V" , (void *)copyInt8Buffer },
128+ { " copyInt32Buffer" , " (J[FIIF)V" , (void *)copyInt32Buffer },
129+ { " copyUInt8Buffer" , " (J[III)V" , (void *)copyUInt8Buffer },
115130 { " copyUInt16Buffer" , " (J[III)V" , (void *)copyUInt16Buffer },
116131 { " copyUIntPtrBuffer" , " (J[III)V" , (void *)copyUIntPtrBuffer },
117- { " copyInt32Buffer" , " (J[FIIF)V" , (void *)copyInt32Buffer },
118132};
119133
120134jint register_com_mta_tehreer_internal_Raw (JNIEnv *env)
0 commit comments