• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MUL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MUL函数的典型用法代码示例。如果您正苦于以下问题:C++ MUL函数的具体用法?C++ MUL怎么用?C++ MUL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MUL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gradMag

// compute gradient magnitude and orientation at each location (uses sse)
void gradMag( float *I, float *M, float *O, int h, int w, int d, bool full ) {
    int x, y, y1, c, h4, s;
    float *Gx, *Gy, *M2;
    __m128 *_Gx, *_Gy, *_M2, _m;
    float *acost = acosTable(), acMult = 10000.0f;
    // allocate memory for storing one column of output (padded so h4%4==0)
    h4 = (h % 4 == 0) ? h : h - (h % 4) + 4;
    s = d * h4 * sizeof(float);
    M2 = (float*) alMalloc(s, 16);
    _M2 = (__m128*) M2;
    Gx = (float*) alMalloc(s, 16);
    _Gx = (__m128*) Gx;
    Gy = (float*) alMalloc(s, 16);
    _Gy = (__m128*) Gy;
    // compute gradient magnitude and orientation for each column
    for ( x = 0; x < w; x++ ) {
        // compute gradients (Gx, Gy) with maximum squared magnitude (M2)
        for (c = 0; c < d; c++) {
            grad1( I + x * h + c * w * h, Gx + c * h4, Gy + c * h4, h, w, x );
            for ( y = 0; y < h4 / 4; y++ ) {
                y1 = h4 / 4 * c + y;
                _M2[y1] = ADD(MUL(_Gx[y1], _Gx[y1]), MUL(_Gy[y1], _Gy[y1]));
                if ( c == 0 ) { continue; }
                _m = CMPGT( _M2[y1], _M2[y] );
                _M2[y] = OR( AND(_m, _M2[y1]), ANDNOT(_m, _M2[y]) );
                _Gx[y] = OR( AND(_m, _Gx[y1]), ANDNOT(_m, _Gx[y]) );
                _Gy[y] = OR( AND(_m, _Gy[y1]), ANDNOT(_m, _Gy[y]) );
            }
        }
        // compute gradient mangitude (M) and normalize Gx
        for ( y = 0; y < h4 / 4; y++ ) {
            _m = MINsse( RCPSQRT(_M2[y]), SET(1e10f) );
            _M2[y] = RCP(_m);
            if (O) { _Gx[y] = MUL( MUL(_Gx[y], _m), SET(acMult) ); }
            if (O) { _Gx[y] = XOR( _Gx[y], AND(_Gy[y], SET(-0.f)) ); }
        };
        memcpy( M + x * h, M2, h * sizeof(float) );
        // compute and store gradient orientation (O) via table lookup
        if ( O != 0 ) for ( y = 0; y < h; y++ ) { O[x * h + y] = acost[(int)Gx[y]]; }
        if ( O != 0 && full ) {
            y1 = ((~size_t(O + x * h) + 1) & 15) / 4;
            y = 0;
            for ( ; y < y1; y++ ) { O[y + x * h] += (Gy[y] < 0) * PI; }
            for ( ; y < h - 4; y += 4 ) STRu( O[y + x * h],
                                                  ADD( LDu(O[y + x * h]), AND(CMPLT(LDu(Gy[y]), SET(0.f)), SET(PI)) ) );
            for ( ; y < h; y++ ) { O[y + x * h] += (Gy[y] < 0) * PI; }
        }
    }
    alFree(Gx);
    alFree(Gy);
    alFree(M2);
}
开发者ID:joelgallant,项目名称:skcf,代码行数:53,代码来源:gradient.cpp


示例2: main

int main(){
	int a,b;
	double c,d;

	printf("Two int Input : ");
	scanf("%d %d",&a,&b);
	printf("%d * %d = %d\n",a,b,MUL(a,b));

	printf("Two double Input : ");
	scanf("%lf %lf",&c,&d);
	printf("%lf * %lf = %lf\n",c,d,MUL(c,d));

	return 0;
}
开发者ID:Phantomn,项目名称:C_language,代码行数:14,代码来源:mac_func.c


示例3: MUL

void RandGen::next() {
  unsigned p[2], q[2], r[2], carry0, carry1;
  
  MUL(a[0], x[0], p);
  ADDEQU(p[0], c, carry0);
  ADDEQU(p[1], carry0, carry1);
  MUL(a[0], x[1], q);
  ADDEQU(p[1], q[0], carry0);
  MUL(a[1], x[0], r);
  x[2] = LOW(carry0 + carry1 + CARRY(p[1], r[0]) + q[1] + r[1] +
	     a[0] * x[2] + a[1] * x[1] + a[2] * x[0]);
  x[1] = LOW(p[1] + r[0]);
  x[0] = LOW(p[0]);
}
开发者ID:GodZza,项目名称:contours,代码行数:14,代码来源:RandGen.cpp


示例4: oob

    //////////////////////////////////////////////////////////////////////////
    // @brief checks if streamout buffer is oob
    // @return <i1> true/false
    Value* oob(const STREAMOUT_COMPILE_STATE& state, Value* pSoCtx, uint32_t buffer)
    {
        Value* returnMask = C(false);

        Value* pBuf = getSOBuffer(pSoCtx, buffer);

        // load enable
        // @todo bool data types should generate <i1> llvm type
        Value* enabled = TRUNC(LOAD(pBuf, { 0, SWR_STREAMOUT_BUFFER_enable }), IRB()->getInt1Ty());

        // load buffer size
        Value* bufferSize = LOAD(pBuf, { 0, SWR_STREAMOUT_BUFFER_bufferSize });
        
        // load current streamOffset
        Value* streamOffset = LOAD(pBuf, { 0, SWR_STREAMOUT_BUFFER_streamOffset });

        // load buffer pitch
        Value* pitch = LOAD(pBuf, { 0, SWR_STREAMOUT_BUFFER_pitch });

        // buffer is considered oob if in use in a decl but not enabled
        returnMask = OR(returnMask, NOT(enabled));

        // buffer is oob if cannot fit a prims worth of verts
        Value* newOffset = ADD(streamOffset, MUL(pitch, C(state.numVertsPerPrim)));
        returnMask = OR(returnMask, ICMP_SGT(newOffset, bufferSize));

        return returnMask;
    }
开发者ID:Kalamatee,项目名称:mesa,代码行数:31,代码来源:streamout_jit.cpp


示例5: MUL

void
gen8_vec4_generator::generate_gs_set_write_offset(struct brw_reg dst,
                                                  struct brw_reg src0,
                                                  struct brw_reg src1)
{
   /* From p22 of volume 4 part 2 of the Ivy Bridge PRM (2.4.3.1 Message
    * Header: M0.3):
    *
    *     Slot 0 Offset. This field, after adding to the Global Offset field
    *     in the message descriptor, specifies the offset (in 256-bit units)
    *     from the start of the URB entry, as referenced by URB Handle 0, at
    *     which the data will be accessed.
    *
    * Similar text describes DWORD M0.4, which is slot 1 offset.
    *
    * Therefore, we want to multiply DWORDs 0 and 4 of src0 (the x components
    * of the register for geometry shader invocations 0 and 1) by the
    * immediate value in src1, and store the result in DWORDs 3 and 4 of dst.
    *
    * We can do this with the following EU instruction:
    *
    *     mul(2) dst.3<1>UD src0<8;2,4>UD src1   { Align1 WE_all }
    */
   default_state.access_mode = BRW_ALIGN_1;
   gen8_instruction *inst =
      MUL(suboffset(stride(dst, 2, 2, 1), 3), stride(src0, 8, 2, 4), src1);
   gen8_set_mask_control(inst, BRW_MASK_DISABLE);
   default_state.access_mode = BRW_ALIGN_16;
}
开发者ID:DirectFB,项目名称:mesa,代码行数:29,代码来源:gen8_vec4_generator.cpp


示例6: LEA

bool SamplerJitCache::Jit_GetTexDataSwizzled4() {
	// Get the horizontal tile pos into tempReg1.
	LEA(32, tempReg1, MScaled(uReg, SCALE_4, 0));
	// Note: imm8 sign extends negative.
	AND(32, R(tempReg1), Imm8(~127));

	// Add vertical offset inside tile to tempReg1.
	LEA(32, tempReg2, MScaled(vReg, SCALE_4, 0));
	AND(32, R(tempReg2), Imm8(31));
	LEA(32, tempReg1, MComplex(tempReg1, tempReg2, SCALE_4, 0));
	// Add srcReg, since we'll need it at some point.
	ADD(64, R(tempReg1), R(srcReg));

	// Now find the vertical tile pos, and add to tempReg1.
	SHR(32, R(vReg), Imm8(3));
	LEA(32, EAX, MScaled(bufwReg, SCALE_4, 0));
	MUL(32, R(vReg));
	ADD(64, R(tempReg1), R(EAX));

	// Last and possible also least, the horizontal offset inside the tile.
	AND(32, R(uReg), Imm8(31));
	SHR(32, R(uReg), Imm8(1));
	MOV(8, R(resultReg), MRegSum(tempReg1, uReg));
	FixupBranch skipNonZero = J_CC(CC_NC);
	// If the horizontal offset was odd, take the upper 4.
	SHR(8, R(resultReg), Imm8(4));
	SetJumpTarget(skipNonZero);
	// Zero out the rest of the bits.
	AND(32, R(resultReg), Imm8(0x0F));

	return true;
}
开发者ID:Orphis,项目名称:ppsspp,代码行数:32,代码来源:SamplerX86.cpp


示例7: main

int main(int argc, const char * argv[]) {
    add(1,2);
    add(1,2);
    PRINTMAX(12, 13);
    PRINTMAX(12, 13);
    printf("%d\n",MAXOFNUMBER(100, 200));
    
    printf("*******************\n");
    double sum = ADD(1.1, 2);//预处理 阶段 就会换成 1+2
    printf("sum = %f\n",sum);
    
    printf("%d\n",ADD(1, 2)*ADD(2, 3));//8 //1+2*2+3
    printf("%d\n",ADD2(1, 2)*ADD2(2, 3));//(1+2)*(2+3)
    
    printf("%d\n",MUL(3-1, 5-2));//(3-1*5-2)
    printf("%d\n",MUL2(3-1, 5-2));//((3-1)*(5-2))
    
    
    printf("*******************\n");
    printf(kPath);
    double r = 2.0;
    double s = PI*r*r;
    double c = 2*PI*r;
    printf("s = %f c= %f\n",s,c);
    return 0;
}
开发者ID:WZLpq,项目名称:XuanIsMe-iOS-Video,代码行数:26,代码来源:main.c


示例8: br_i32_mulacc

/* see inner.h */
void
br_i32_mulacc(uint32_t *d, const uint32_t *a, const uint32_t *b)
{
	size_t alen, blen, u;

	alen = (a[0] + 31) >> 5;
	blen = (b[0] + 31) >> 5;
	d[0] = a[0] + b[0];
	for (u = 0; u < blen; u ++) {
		uint32_t f;
		size_t v;
		uint64_t cc;

		f = b[1 + u];
		cc = 0;
		for (v = 0; v < alen; v ++) {
			uint64_t z;

			z = (uint64_t)d[1 + u + v] + MUL(f, a[1 + v]) + cc;
			cc = z >> 32;
			d[1 + u + v] = (uint32_t)z;
		}
		d[1 + u + alen] = (uint32_t)cc;
	}
}
开发者ID:Alcaro,项目名称:Arlib,代码行数:26,代码来源:i32_mulacc.c


示例9: gradMagNorm

// normalize gradient magnitude at each location (uses sse)
void gradMagNorm( float *M, float *S, int h, int w, float norm ) {
  __m128 *_M, *_S, _norm; int i=0, n=h*w, n4=n/4;
  _S = (__m128*) S; _M = (__m128*) M; _norm = SET(norm);
  bool sse = !(size_t(M)&15) && !(size_t(S)&15);
  if(sse) for(; i<n4; i++) { *_M=MUL(*_M,RCP(ADD(*_S++,_norm))); _M++; }
  if(sse) i*=4; for(; i<n; i++) M[i] /= (S[i] + norm);
}
开发者ID:3arbouch,项目名称:PersonDetection,代码行数:8,代码来源:gradientMex.cpp


示例10: CDD

long long CDD(int firstDigit,char * number,int digitsLeft,int NDigits)
{
	long long int res;
	
	res=firstDigit*MUL(digitsLeft,NDigits-1);
	if(NDigits==1) //base case
	{
		#ifdef debug
	printf("\nCDD ( %d,%s,%d,%d ) returning %lld",firstDigit,number,digitsLeft,NDigits,res);
	#endif
	
		return res+1;
	}
	if(number[1]=='0'||number[1]=='1')
	{
		firstDigit=0;
	}
	else if(number[1]<number[0])
	{
		firstDigit=number[1]-48+1;
		}
	else
	{
			firstDigit=number[1]-48;
	
	}
	res+=CDD(firstDigit,number+1,digitsLeft-1,NDigits-1);
	#ifdef debug
	printf("\nCDD ( %d,%s,%d,%d ) returning %lld",firstDigit,number,digitsLeft,NDigits,res);
	#endif
	return res;
}
开发者ID:Achal-Aggarwal,项目名称:entire-src,代码行数:32,代码来源:RepeatingDigits.c


示例11: assert

static Value *binaryExprInterp(Node *node, void *parser)
{
#ifndef NDEBUG
	assert(node->type == NT_BINARY_EXPR);
#endif
	BinaryExpr *e = (BinaryExpr *)node;
#ifdef LOG_INTERP
	logInterpPrefix(parser);
	rawlog("binaryExprInterp\n");
	((Parser *)parser)->interpDepth++;
#endif
	assert(e->lhs && e->rhs);
	Value *lhs = e->lhs->interp(e->lhs, parser);
	Value *rhs = e->rhs->interp(e->rhs, parser);
	switch (e->op) {
	case TK_ADD: e->value = ADD(lhs, rhs, e->value); break; /* + */
	case TK_SUB: e->value = SUB(lhs, rhs, e->value); break; /* - */
	case TK_MUL: e->value = MUL(lhs, rhs, e->value); break; /* * */
	case TK_DIV: e->value = DIV(lhs, rhs, e->value); break; /* / */
	default:
		assert(0);
		break;
	}
#ifdef LOG_INTERP
	logInterpPrefix(parser);
	rawlog("%s\n", token2str(e->op));
	((Parser *)parser)->interpDepth--;
#endif
	return e->value;
}
开发者ID:wfwt,项目名称:jszb,代码行数:30,代码来源:parser.cpp


示例12: main

int main() {
    int x = 0;
    int y = 0;
    x = readInt();
    y = readInt();
    printf("求和结果是%d\n", MUL(x,y));
    return 0;
}
开发者ID:soplist,项目名称:study-c-cpp,代码行数:8,代码来源:07mul.c


示例13: VECT

bool Triangle::checkPoint(const Point& point) const
{
    Point ca = VECT(points[0], points[1]);
    Point cd = VECT(points[0], point);
    Point ab = VECT(points[1], points[2]);
    Point ad = VECT(points[1], point);
    Point bc = VECT(points[2], points[0]);
    Point bd = VECT(points[2], point);

    int mul1 = MUL(ca, cd);
    int mul2 = MUL(ab, ad);
    int mul3 = MUL(bc, bd);

    return ((SGN(mul1) == SGN(mul2)) &&
            (SGN(mul2) == SGN(mul3)) &&
            (SGN(mul3) == SGN(mul1)));
}
开发者ID:sumboid,项目名称:qt-problems,代码行数:17,代码来源:Triangle.cpp


示例14: SET

// gradMagNorm( M, S, norm ) - operates on M - see gradientMag.m
// gradientMex('gradientMagNorm',M,S,normConst);
// normalize gradient magnitude at each location (uses sse)
void GradientMagnitudeChannel::gradMagNorm(float *M, float *S, int h, int w) {
  float norm = normalizationConstant;
  __m128 *_M, *_S, _norm; int i=0, n=h*w, n4=n/4;
  _S = (__m128*) S; _M = (__m128*) M; _norm = SET(norm);
  bool sse = !(size_t(M)&15) && !(size_t(S)&15);
  if(sse) { for(; i<n4; i++) *_M++=MUL(*_M,RCP(ADD(*_S++,_norm))); i*=4; }
  for(; i<n; i++) M[i] /= (S[i] + norm);
}
开发者ID:gustavofuhr,项目名称:opencv_dollar_detector,代码行数:11,代码来源:GradientMagnitudeChannel.cpp


示例15: gradQuantize

// helper for gradHist, quantize O and M into O0, O1 and M0, M1 (uses sse)
void gradQuantize( float *O, float *M, int *O0, int *O1, float *M0, float *M1,
  int nb, int n, float norm, int nOrients, bool full, bool interpolate )
{
  // assumes all *OUTPUT* matrices are 4-byte aligned
  int i, o0, o1; float o, od, m;
  __m128i _o0, _o1, *_O0, *_O1; __m128 _o, _od, _m, *_M0, *_M1;
  // define useful constants
  const float oMult=(float)nOrients/(full?2*PI:PI); const int oMax=nOrients*nb;
  const __m128 _norm=SET(norm), _oMult=SET(oMult), _nbf=SET((float)nb);
  const __m128i _oMax=SET(oMax), _nb=SET(nb);
  // perform the majority of the work with sse
  _O0=(__m128i*) O0; _O1=(__m128i*) O1; _M0=(__m128*) M0; _M1=(__m128*) M1;
  if( interpolate ) for( i=0; i<=n-4; i+=4 ) {
    _o=MUL(LDu(O[i]),_oMult); _o0=CVT(_o); _od=SUB(_o,CVT(_o0));
    _o0=CVT(MUL(CVT(_o0),_nbf)); _o0=AND(CMPGT(_oMax,_o0),_o0); *_O0++=_o0;
    _o1=ADD(_o0,_nb); _o1=AND(CMPGT(_oMax,_o1),_o1); *_O1++=_o1;
    _m=MUL(LDu(M[i]),_norm); *_M1=MUL(_od,_m); *_M0++=SUB(_m,*_M1); _M1++;
  } else for( i=0; i<=n-4; i+=4 ) {
    _o=MUL(LDu(O[i]),_oMult); _o0=CVT(ADD(_o,SET(.5f)));
    _o0=CVT(MUL(CVT(_o0),_nbf)); _o0=AND(CMPGT(_oMax,_o0),_o0); *_O0++=_o0;
    *_M0++=MUL(LDu(M[i]),_norm); *_M1++=SET(0.f); *_O1++=SET(0);
  }
  // compute trailing locations without sse
  if( interpolate ) for(; i<n; i++ ) {
    o=O[i]*oMult; o0=(int) o; od=o-o0;
    o0*=nb; if(o0>=oMax) o0=0; O0[i]=o0;
    o1=o0+nb; if(o1==oMax) o1=0; O1[i]=o1;
    m=M[i]*norm; M1[i]=od*m; M0[i]=m-M1[i];
  } else for(; i<n; i++ ) {
    o=O[i]*oMult; o0=(int) (o+.5f);
    o0*=nb; if(o0>=oMax) o0=0; O0[i]=o0;
    M0[i]=M[i]*norm; M1[i]=0; O1[i]=0;
  }
}
开发者ID:3arbouch,项目名称:PersonDetection,代码行数:35,代码来源:gradientMex.cpp


示例16: DEGREE

struct LongNumber DEGREE(struct LongNumber a, struct LongNumber b, struct LongNumber c)
{ 
	struct LongNumber res;
	if(a.size < c.size)
		res.size = c.size + c.size;
	else
		res.size = a.size + a.size;

	res = allocate(res, res.size);
    res = zero(res, res.size); 
	res.pointer[0] = 1;

	struct LongNumber com;
	com.size = 1;
	com = allocate(com, com.size);
	com.pointer[0] = 0;

	struct LongNumber value;
	value.size = res.size;
	value = allocate(value, value.size);
    value = zero(value, value.size);

	memcpy(value.pointer, a.pointer, a.size * sizeof(unsigned int));

	struct LongNumber pow = copy(b);

	while((compare(pow,com)) > 0)
	{
		if((pow.pointer[0] & 1)==1)
		{
			res = MUL(res, value);
			res = DIV(res, c, 2);
		}

		value = MUL(value, value);
		value = DIV(value, c, 2);
		pow = SmallDIV(pow, 2);
	}

	com = clear(com);
	pow = clear(pow);
	value = clear(value);

	return res;
}
开发者ID:Starenkov-D,项目名称:TCHMK,代码行数:45,代码来源:LongNumber.c


示例17: opticalFlowHsMex

// run nIter iterations of Horn & Schunk optical flow (alters Vx, Vy)
void opticalFlowHsMex( float *Vx, float *Vy, const float *Ex, const float *Ey,
  const float *Et, const float *Z, const int h, const int w, const int nIter )
{
  int x, y, x1, i, t, s; float my, mx, m, *Vx0, *Vy0;
  s=w*h*sizeof(float); Vx0=new float[s]; Vy0=new float[s];
  for( t=0; t<nIter; t++ ) {
    memcpy(Vx0,Vx,s); memcpy(Vy0,Vy,s);
    for( x=1; x<w-1; x++ ) {
      // do as much work as possible in SSE (assume non-aligned memory)
      for( y=1; y<h-4; y+=4 ) {
        x1=x*h; i=x1+y; __m128 _mx, _my, _m;
        _my=MUL(ADD(LDu(Vy0[x1-h+y]),LDu(Vy0[x1+h+y]),
          LDu(Vy0[x1+y-1]),LDu(Vy0[x1+y+1])),.25f);
        _mx=MUL(ADD(LDu(Vx0[x1-h+y]),LDu(Vx0[x1+h+y]),
          LDu(Vx0[x1+y-1]),LDu(Vx0[x1+y+1])),.25f);
        _m=MUL(ADD(MUL(LDu(Ey[i]),_my),MUL(LDu(Ex[i]),_mx),
          LDu(Et[i])),LDu(Z[i]));
        STRu(Vx[i],SUB(_mx,MUL(LDu(Ex[i]),_m)));
        STRu(Vy[i],SUB(_my,MUL(LDu(Ey[i]),_m)));
      }
      // do remainder of work in regular loop
      for( ; y<h-1; y++ ) {
        x1=x*h; i=x1+y;
        mx=.25f*(Vx0[x1-h+y]+Vx0[x1+h+y]+Vx0[x1+y-1]+Vx0[x1+y+1]);
        my=.25f*(Vy0[x1-h+y]+Vy0[x1+h+y]+Vy0[x1+y-1]+Vy0[x1+y+1]);
        m = (Ex[i]*mx + Ey[i]*my + Et[i])*Z[i];
        Vx[i]=mx-Ex[i]*m; Vy[i]=my-Ey[i]*m;
      }
    }
  }
  delete [] Vx0; delete [] Vy0;
}
开发者ID:CV-IP,项目名称:ObjectFlow,代码行数:33,代码来源:opticalFlowHsMex.cpp


示例18: defined

void 
pcl::people::HOG::gradQuantize (float *O, float *M, int *O0, int *O1, float *M0, float *M1, int n_orients, int nb, int n, float norm) const
{
#if defined(__SSE2__)
  // assumes all *OUTPUT* matrices are 4-byte aligned
  int i, o0, o1; float o, od, m;
  __m128i _o0, _o1, *_O0, *_O1; __m128 _o, _o0f, _m, *_M0, *_M1;
  // define useful constants
  const float oMult=(float)n_orients/M_PI; const int oMax=n_orients*nb;
  const __m128 _norm=SET(norm), _oMult=SET(oMult), _nbf=SET((float)nb);
  const __m128i _oMax=SET(oMax), _nb=SET(nb);

  // perform the majority of the work with sse
  _O0=(__m128i*) O0; _O1=(__m128i*) O1; _M0=(__m128*) M0; _M1=(__m128*) M1;
  for( i=0; i<=n-4; i+=4 ) {
  _o=MUL(LDu(O[i]),_oMult); _o0f=CVT(CVT(_o)); _o0=CVT(MUL(_o0f,_nbf));
  _o1=ADD(_o0,_nb); _o1=AND(CMPGT(_oMax,_o1),_o1);
  *_O0++=_o0; *_O1++=_o1; _m=MUL(LDu(M[i]),_norm);
  *_M1=MUL(SUB(_o,_o0f),_m); *_M0=SUB(_m,*_M1); _M0++; _M1++;
  }

  // compute trailing locations without sse
  for( ; i<n; i++ ) {
  o=O[i]*oMult; m=M[i]*norm; o0=(int) o; od=o-o0;
  o0*=nb; o1=o0+nb; if(o1==oMax) o1=0;
  O0[i]=o0; O1[i]=o1; M1[i]=od*m; M0[i]=m-M1[i];
  }
#else
  int i, o0, o1;
  float o, od, m;

  // define useful constants
  const float oMult=(float)n_orients/M_PI; const int oMax=n_orients*nb;

  // compute trailing locations without sse
  for( i = 0; i<n; i++ )
  {
    o=O[i]*oMult; m=M[i]*norm; o0=(int) o; od=o-o0;
    o0*=nb; o1=o0+nb; if(o1==oMax) o1=0;
    O0[i]=o0; O1[i]=o1; M1[i]=od*m; M0[i]=m-M1[i];
  }
#endif
}
开发者ID:WuNL,项目名称:pcl,代码行数:43,代码来源:hog.cpp


示例19: main

int main(void)
{

	printf("ADDITION:\t %f + %f = %f\n", WERT1, WERT2, ADD(WERT1,WERT2));
	printf("SUBTRAKTION:\t %f - %f = %f\n", WERT1, WERT2, SUB(WERT1,WERT2));
	printf("MULTIPLIKATION:\t %f * %f = %f\n", WERT1, WERT2, MUL(WERT1,WERT2));
	printf("DIVISION:\t %f / %f = %f\n", WERT1, WERT2, DIV(WERT1,WERT2));

	return 0;
}
开发者ID:menewol,项目名称:EPRUE_UEZ3,代码行数:10,代码来源:a1.c


示例20: Jit_GetTexDataSwizzled

bool SamplerJitCache::Jit_GetTexData(const SamplerID &id, int bitsPerTexel) {
	if (id.swizzle) {
		return Jit_GetTexDataSwizzled(id, bitsPerTexel);
	}

	// srcReg might be EDX, so let's copy that before we multiply.
	switch (bitsPerTexel) {
	case 32:
	case 16:
	case 8:
		LEA(64, tempReg1, MComplex(srcReg, uReg, bitsPerTexel / 8, 0));
		break;

	case 4: {
		XOR(32, R(tempReg2), R(tempReg2));
		SHR(32, R(uReg), Imm8(1));
		FixupBranch skip = J_CC(CC_NC);
		// Track whether we shifted a 1 off or not.
		MOV(32, R(tempReg2), Imm32(4));
		SetJumpTarget(skip);
		LEA(64, tempReg1, MRegSum(srcReg, uReg));
		break;
	}

	default:
		return false;
	}

	MOV(32, R(EAX), R(vReg));
	MUL(32, R(bufwReg));

	switch (bitsPerTexel) {
	case 32:
	case 16:
	case 8:
		MOVZX(32, bitsPerTexel, resultReg, MComplex(tempReg1, RAX, bitsPerTexel / 8, 0));
		break;

	case 4: {
		SHR(32, R(RAX), Imm8(1));
		MOV(8, R(resultReg), MRegSum(tempReg1, RAX));
		// RCX is now free.
		MOV(8, R(RCX), R(tempReg2));
		SHR(8, R(resultReg), R(RCX));
		// Zero out any bits not shifted off.
		AND(32, R(resultReg), Imm8(0x0F));
		break;
	}

	default:
		return false;
	}

	return true;
}
开发者ID:Orphis,项目名称:ppsspp,代码行数:55,代码来源:SamplerX86.cpp



注:本文中的MUL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MULT函数代码示例发布时间:2022-05-30
下一篇:
C++ MTest_Init函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap