Example #1
0
//整体乘法接口
UINT32 galois_single_multiply(UINT32 x,UINT32 y,UINT32 w)//整体乘法接口
{
	UINT32 sindex,res;
	if(x==0||y==0) return 0;
	sindex=mult_type[w];
	switch(sindex)
	{
	case TABLE:
		//检测multable的情况
		if(galois_mult_tables[w]==NULL)//如果不存在
		{
			res=galois_multtable_create(w);
			if(res==FALSE)//生成失败
			{
				show_error("galois","multiply","tablecreatefail");
				return FALSE;
			}
		}
		return galois_multtable_multiply(x,y,w);
		break;
	case LOGS:
		if(galois_log_tables[w]==NULL)
		{
			res=galois_logtable_create(w);
			if(res==FALSE)
			{
				show_error("galois","logtables","toobig");
				return FALSE;
			}
		}
		return galois_log_multiply(x,y,w);
		break;
	case SHIFT:
		return galois_shift_multiply(x,y,w);
		break;
	case SPLITW8:
		if(galois_split_w8[0]==NULL)//和上面的操作一样
		{ 
			res=galois_create_split_w8_table();
			if(res==NULL)
			{
				show_error("galois","splittables","toobig");
				return FALSE;
			}
		}
		return galois_split_w8_multiply(x,y);
		break;
	}
}
Example #2
0
/*
* Class:     eu_vandertil_jerasure_jni_Galois
* Method:    galois_multtable_multiply
* Signature: (III)I
*/
JNIEXPORT jint JNICALL Java_eu_vandertil_jerasure_jni_Galois_galois_1multtable_1multiply
	(JNIEnv *env, jclass clazz, jint x, jint y, jint w)
{
	return galois_multtable_multiply(x, y, w);
}