dotpv2_timer2.c

来自「ccs3.3下带的基于dm642开发例程」· C语言 代码 · 共 27 行

C
27
字号
/*
 * Copyright (C) 2003 Texas Instruments Incorporated
 * All Rights Reserved
 */
/*
 *---------dotpV2_timer2.c---------
 * This file contains 'dot product version 2' routine, which is raw C
 * with some optimization by giving more information to compiler
 * in order to unroll the loop and reduce the cycle count.
 */

int dotprod_ver2 (const short *restrict x, const short *restrict h, int nx)
{
	int i, sum = 0;
   
	//Assumption: Vectors x and h are double-word aligned
	_nassert((int)x % 8 == 0);
	_nassert((int)h % 8 == 0);
   
    //Assumption: Counter nx (vector length) is atleast 36 and multiple of 4
	#pragma MUST_ITERATE(36,,4)
	for (i=0; i<nx; i++)
		sum += x[i] * h[i];

	return sum;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?