@@ -99,20 +99,20 @@ JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createEmptyArray(JNIEnv *env, j
9999 return ret;
100100}
101101
102- #define CREATE_ARRAY_T (Ty, ty ) \
102+ #define CREATE_ARRAY_T_ (Ty, ty, wty ) \
103103 JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createArrayFrom##Ty \
104104 (JNIEnv *env, jclass clazz, jintArray dims, j##ty##Array elems) \
105105 { \
106106 jlong ret; \
107107 try { \
108108 jint* dimptr = env->GetIntArrayElements (dims,0 ); \
109- j##ty * inptr= env->Get ##Ty##ArrayElements (elems,0 ); \
109+ wty * inptr= (wty*) env->Get ##Ty##ArrayElements (elems,0 ); \
110110 af::array *A = new af::array (dimptr[0 ],dimptr[1 ], \
111- dimptr[2 ],dimptr[3 ],inptr); \
111+ dimptr[2 ],dimptr[3 ],inptr);\
112112 \
113113 ret = (jlong)(A); \
114114 env->ReleaseIntArrayElements (dims,dimptr,0 ); \
115- env->Release ##Ty##ArrayElements (elems,inptr,0 ); \
115+ env->Release ##Ty##ArrayElements (elems,(j##ty*) inptr,0 ); \
116116 } catch (af::exception& e) { \
117117 ret = 0 ; \
118118 } catch (std::exception& e) { \
@@ -121,10 +121,14 @@ JNIEXPORT jlong JNICALL Java_com_arrayfire_Array_createEmptyArray(JNIEnv *env, j
121121 return ret; \
122122 } \
123123
124+
125+ #define CREATE_ARRAY_T (Ty, ty ) CREATE_ARRAY_T_(Ty, ty, ty)
126+
124127CREATE_ARRAY_T (Float, float );
125128CREATE_ARRAY_T (Double, double );
126129CREATE_ARRAY_T (Int, int );
127- CREATE_ARRAY_T (Boolean, boolean);
130+
131+ CREATE_ARRAY_T_ (Boolean, boolean, bool );
128132
129133#undef CREATE_ARRAY_T
130134
0 commit comments