static inline int *cauchy_good_general_coding_matrix_setup(int k, int m, int w, int *matrix) { int i; if (m == 2 && k <= cbest_max_k[w]) { if (!cbest_init) { cbest_init = 1; cbest_all[0] = cbest_0; cbest_all[1] = cbest_1; cbest_all[2] = cbest_2; cbest_all[3] = cbest_3; cbest_all[4] = cbest_4; cbest_all[5] = cbest_5; cbest_all[6] = cbest_6; cbest_all[7] = cbest_7; cbest_all[8] = cbest_8; cbest_all[9] = cbest_9; cbest_all[10] = cbest_10; cbest_all[11] = cbest_11; cbest_all[12] = cbest_12; cbest_all[13] = cbest_13; cbest_all[14] = cbest_14; cbest_all[15] = cbest_15; cbest_all[16] = cbest_16; cbest_all[17] = cbest_17; cbest_all[18] = cbest_18; cbest_all[19] = cbest_19; cbest_all[20] = cbest_20; cbest_all[21] = cbest_21; cbest_all[22] = cbest_22; cbest_all[23] = cbest_23; cbest_all[24] = cbest_24; cbest_all[25] = cbest_25; cbest_all[26] = cbest_26; cbest_all[27] = cbest_27; cbest_all[28] = cbest_28; cbest_all[29] = cbest_29; cbest_all[30] = cbest_30; cbest_all[31] = cbest_31; cbest_all[32] = (int *) cbest_32; } for (i = 0; i < k; i++) { matrix[i] = 1; matrix[i+k] = cbest_all[w][i]; } return matrix; } else { matrix = cauchy_original_coding_matrix_noalloc(k, m, w, matrix); if (matrix == NULL) return NULL; cauchy_improve_coding_matrix(k, m, w, matrix); return matrix; } }
/* * Class: eu_vandertil_jerasure_jni_Cauchy * Method: cauchy_improve_coding_matrix * Signature: (III[I)V */ JNIEXPORT void JNICALL Java_eu_vandertil_jerasure_jni_Cauchy_cauchy_1improve_1coding_1matrix (JNIEnv *env, jclass clazz, jint k, jint m, jint w, jintArray jmatrix) { jint* matrix = env->GetIntArrayElements(jmatrix, NULL); if(matrix == NULL) { throwOutOfMemoryError(env, "Error getting matrix from Java"); return; } cauchy_improve_coding_matrix(k, m, w, (int*)matrix); env->ReleaseIntArrayElements(jmatrix, matrix, NULL); }