您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CMP函数代码示例

51自学网 2021-06-01 20:02:50
  C++
这篇教程C++ CMP函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ll_to_n

void ll_to_n(num *a,ll n){    ll hover[N];    register int k=0;    if(n==0){        a->n=1;        a->a[0]=0;        a->sbit=PLUS;        return;    }    a->sbit=CMP(n,0);    n=n*a->sbit;    while(n){        hover[k++]=n%B;        n/=B;    }    RM0(hover,k,a);}
开发者ID:nphuc,项目名称:alg,代码行数:17,


示例2: compareResults

C4Err compareResults(const void* expected, const void* calculated, size_t len,                        DumpFormatType format, char* comment  ){    C4Err err = kC4Err_NoErr;        err = CMP(expected, calculated, len)    ? kC4Err_NoErr : kC4Err_SelfTestFailed;        if( (err != kC4Err_NoErr)  && IsntNull(comment) && (format != kResultFormat_None))    {        OPTESTLogError( "/n/t/tFAILED %s/n",comment );        switch(format)        {            case kResultFormat_Byte:                OPTESTLogError( "/t/texpected:/n");                dumpHex(IF_LOG_ERROR, ( uint8_t*) expected, (int)len, 0);                OPTESTLogError( "/t/tcalulated:/n");                dumpHex(IF_LOG_ERROR,( uint8_t*) calculated, (int)len, 0);                OPTESTLogError( "/n");                break;                            case kResultFormat_Long:                OPTESTLogError( "/t/texpected:/n");                dump64(IF_LOG_ERROR,( uint8_t*) expected, len);                OPTESTLogError( "/t/tcalulated:/n");                dump64(IF_LOG_ERROR,( uint8_t*) calculated, len );                OPTESTLogError( "/n");                break;                            case kResultFormat_Cstr:                OPTESTLogError( "/t/texpected:/n");                dump8(IF_LOG_ERROR,( uint8_t*) expected, len);                OPTESTLogError( "/t/tcalulated:/n");                dump8(IF_LOG_ERROR,( uint8_t*) calculated, len );                OPTESTLogError( "/n");                break;                                           default:                break;        }    }        return err;}
开发者ID:rhardman,项目名称:C4,代码行数:45,


示例3: cmp_mon_ref

static ERTS_INLINE int cmp_mon_ref(Eterm ref1, Eterm ref2) {    Eterm *b1, *b2;    b1 = boxed_val(ref1);    b2 = boxed_val(ref2);    if (is_ref_thing_header(*b1)) {	if (is_ref_thing_header(*b2)) {	    return memcmp(b1+1,b2+1,ERTS_REF_WORDS*sizeof(Uint));	}	return -1;    }    if (is_ref_thing_header(*b2)) {	return 1;    }    return CMP(ref1,ref2);}
开发者ID:DavidAlphaFox,项目名称:my_otp,代码行数:18,


示例4: check_crc

/* detect if a block is used in a particular pattern */static intcheck_crc(const u_char *S, const u_char *buf, u_int32_t len){	u_int32_t crc;	const u_char *c;	crc = 0;	for (c = buf; c < buf + len; c += SSH_BLOCKSIZE) {		if (!CMP(S, c)) {			crc_update(&crc, 1);			crc_update(&crc, 0);		} else {			crc_update(&crc, 0);			crc_update(&crc, 0);		}	}	return crc == 0;}
开发者ID:randombit,项目名称:hacrypto,代码行数:19,


示例5: main

int main(int argc, char* argv[]){  const size_t size = (argc > 1) ? atoi(argv[1]) : 32;  cmpvec inputData;  for (size_t i = 0; i < size; ++i) {    inputData.push_back(CMP(0.1 + i, 0.2 * i));  }  cmpvec bf;  ft_bf(size, inputData, bf);  if (0) {    cmpvec gsl;    ft_gsl(size, inputData, gsl);    print_diff(bf, gsl);  }  if(0) {    cmpvec fftw;    ft_fftw(size, inputData, fftw);    print_diff(bf, fftw);  }  if(0) {    cmpvec fftw_d;    const int isz = size;    ft_fftw_d(1, &isz, inputData, fftw_d);    print_diff(bf, fftw_d);  }  if(1) {    cmpvec fftw_d1;    const int sz1[] = { 3, 5 };    ft_fftw_d(2, &sz1[0], inputData, fftw_d1);    cmpvec fftw_d2;    const int sz2[] = { 5, 3  };    ft_fftw_d(2, &sz2[0], inputData, fftw_d2);    print_both(fftw_d1, fftw_d2);  }  return 0;}
开发者ID:fatchat,项目名称:fft_pricing,代码行数:44,


示例6: heap_push

void heap_push(heap* h, heap_type datum) {  // resize if necessary, with a doubling strategy  if ( h->count == h->allocated ) {    h->allocated <<= 1;    h->data = SAFEREALLOC(h->data, sizeof(heap_type) * h->allocated);      }    // and insert element  unsigned int index, parent;  for ( index = h->count++,	  parent = (index - 1) >> 1;	index &&	  !CMP(h->data[parent], datum);	index = parent,	  parent = (index - 1) >> 1)    {      h->data[index] = h->data[parent];    }  h->data[index] = datum;}
开发者ID:beneills,项目名称:world,代码行数:20,


示例7: qsort_chk

/* Verify anti-symmetry and transitivity for comparator CMP on sorted array   of N SIZE-sized elements pointed to by BASE.  */voidqsort_chk (void *base, size_t n, size_t size,	   int (*cmp)(const void *, const void *)){#if 0#define LIM(n) (n)#else  /* Limit overall time complexity to O(n log n).  */#define LIM(n) ((n) <= 16 ? (n) : 12 + floor_log2 (n))#endif#define ELT(i) ((const char *) base + (i) * size)#define CMP(i, j) cmp (ELT (i), ELT (j))#define ERR2(i, j) qsort_chk_error (ELT (i), ELT (j), NULL, cmp)#define ERR3(i, j, k) qsort_chk_error (ELT (i), ELT (j), ELT (k), cmp)  size_t i1, i2, i, j;  /* This outer loop iterates over maximum spans [i1, i2) such that     elements within each span compare equal to each other.  */  for (i1 = 0; i1 < n; i1 = i2)    {      /* Position i2 one past last element that compares equal to i1'th.  */      for (i2 = i1 + 1; i2 < n; i2++)	if (CMP (i1, i2))	  break;	else if (CMP (i2, i1))	  return ERR2 (i1, i2);      size_t lim1 = LIM (i2 - i1), lim2 = LIM (n - i2);      /* Verify that other pairs within current span compare equal.  */      for (i = i1 + 1; i + 1 < i2; i++)	for (j = i + 1; j < i1 + lim1; j++)	  if (CMP (i, j))	    return ERR3 (i, i1, j);	  else if (CMP (j, i))	    return ERR2 (i, j);      /* Verify that elements within this span compare less than         elements beyond the span.  */      for (i = i1; i < i2; i++)	for (j = i2; j < i2 + lim2; j++)	  if (CMP (i, j) >= 0)	    return ERR3 (i, i1, j);	  else if (CMP (j, i) <= 0)	    return ERR2 (i, j);    }#undef ERR3#undef ERR2#undef CMP#undef ELT#undef LIM}
开发者ID:vinriviere,项目名称:m68k-atari-mint-gcc,代码行数:50,


示例8: tm_is_lessthan

static int tm_is_lessthan(struct tm *x, struct tm *y){#define CMP(f)                                                                                                                     /    if (x->f < y->f)                                                                                                               /        return 1;                                                                                                                  /    else if (x->f > y->f)                                                                                                          /        return 0;    CMP(tm_year);    CMP(tm_mon);    CMP(tm_mday);    CMP(tm_hour);    CMP(tm_min);    CMP(tm_sec);    return 0;#undef CMP}
开发者ID:ancuop,项目名称:h2o,代码行数:16,


示例9: _dbg_assert_msg_

void Jit::WriteExit(u32 destination, int exit_num){	_dbg_assert_msg_(JIT, exit_num < MAX_JIT_BLOCK_EXITS, "Expected a valid exit_num");	if (!Memory::IsValidAddress(destination)) {		ERROR_LOG_REPORT(JIT, "Trying to write block exit to illegal destination %08x: pc = %08x", destination, currentMIPS->pc);	}	// If we need to verify coreState and rewind, we may not jump yet.	if (js.afterOp & (JitState::AFTER_CORE_STATE | JitState::AFTER_REWIND_PC_BAD_STATE))	{		// CORE_RUNNING is <= CORE_NEXTFRAME.		CMP(32, M((void*)&coreState), Imm32(CORE_NEXTFRAME));		FixupBranch skipCheck = J_CC(CC_LE);		MOV(32, M(&mips_->pc), Imm32(js.compilerPC));		WriteSyscallExit();		SetJumpTarget(skipCheck);		js.afterOp = JitState::AFTER_NONE;	}	WriteDowncount();	//If nobody has taken care of this yet (this can be removed when all branches are done)	JitBlock *b = js.curBlock;	b->exitAddress[exit_num] = destination;	b->exitPtrs[exit_num] = GetWritableCodePtr();	// Link opportunity!	int block = blocks.GetBlockNumberFromStartAddress(destination);	if (block >= 0 && jo.enableBlocklink) {		// It exists! Joy of joy!		JMP(blocks.GetBlock(block)->checkedEntry, true);		b->linkStatus[exit_num] = true;	} else {		// No blocklinking.		MOV(32, M(&mips_->pc), Imm32(destination));		JMP(asm_.dispatcher, true);	}}
开发者ID:Versus9,项目名称:ppsspp,代码行数:39,


示例10: conf_sort

static intconf_sort(const void *v1, const void *v2){	const struct conf *c1 = v1;	const struct conf *c2 = v2;#define CMP(a, b, f) /	if ((a)->f > (b)->f) return -1; /	else if ((a)->f < (b)->f) return 1	CMP(c1, c2, c_ss.ss_family);	CMP(c1, c2, c_lmask);	CMP(c1, c2, c_port);	CMP(c1, c2, c_proto);	CMP(c1, c2, c_family);	CMP(c1, c2, c_rmask);	CMP(c1, c2, c_uid);#undef CMP	return 0;}
开发者ID:0xffffffRabbit,项目名称:NextBSD-1,代码行数:20,


示例11: hashset_add

int hashset_add(hashset_p set, const void *item, size_t bytes){	slot_p slot = NULL, new_slot = NULL;	slotlist_p slotlist = &set->slotlists[HASH(set, item, bytes) % set->slotlists_n];	slot_p *pslot = &slotlist->list;	int is_new = !(slot = *pslot);	while (slot) {		if (!CMP(set, &slot->data, item, bytes)) {			return -1;		}		pslot = &slot->next;		slot = *pslot;	}	*pslot = new_slot = (slot_p) malloc(bytes + sizeof(slot_p));	if (!new_slot) {		return -2;	}	new_slot->next = NULL;	memcpy(&new_slot->data, item, bytes);	if (!set->non_null) {		set->non_null = slotlist;	} else if (is_new) {		set->non_null->pre = slotlist;		slotlist->next = set->non_null;		set->non_null = slotlist;	}	++set->size;	return 0;}
开发者ID:nicky-zs,项目名称:dbscan,代码行数:37,


示例12: TopK

	//统计出现次数最多的前K种水果	void TopK(vector<string>& fruits)	{		//统计水果出现的次数		map<string, int> fruitCount;		size_t size = fruits.size();		for (size_t i = 0; i < size; ++i)		{			fruitCount[fruits[i]]++;		}		//排序		vector<map<string, int>::iterator> v; //将数据保存在可以随机访问的容器里。		map<string, int>::iterator it = fruitCount.begin();		while (it != fruitCount.end())		{			v.push_back(it);			++it;		}		struct CMP		{			bool operator()(const map<string, int>::iterator l,							const map<string, int>::iterator r) const			{				return (l->second > r->second);			}		};		sort(v.begin(), v.end(), CMP());				//输出排序结果		for (size_t i = 0; i < v.size(); ++i)		{			cout << v[i]->first << "-" << v[i]->second << endl;		}			}
开发者ID:XHfight,项目名称:Data-Structure,代码行数:37,


示例13: try_lcs

static int try_lcs(struct histindex *index, struct region *lcs, int b_ptr,	int line1, int count1, int line2, int count2){	unsigned int b_next = b_ptr + 1;	struct record *rec = index->records[TABLE_HASH(index, 2, b_ptr)];	unsigned int as, ae, bs, be, np, rc;	int should_break;	for (; rec; rec = rec->next) {		if (rec->cnt > index->cnt) {			if (!index->has_common)				index->has_common = CMP(index, 1, rec->ptr, 2, b_ptr);			continue;		}		as = rec->ptr;		if (!CMP(index, 1, as, 2, b_ptr))			continue;		index->has_common = 1;		for (;;) {			should_break = 0;			np = NEXT_PTR(index, as);			bs = b_ptr;			ae = as;			be = bs;			rc = rec->cnt;			while (line1 < (int)as && line2 < (int)bs				&& CMP(index, 1, as - 1, 2, bs - 1)) {				as--;				bs--;				if (1 < rc)					rc = XDL_MIN(rc, CNT(index, as));			}			while ((int)ae < LINE_END(1) && (int)be < LINE_END(2)				&& CMP(index, 1, ae + 1, 2, be + 1)) {				ae++;				be++;				if (1 < rc)					rc = XDL_MIN(rc, CNT(index, ae));			}			if (b_next <= be)				b_next = be + 1;			if (lcs->end1 - lcs->begin1 < ae - as || rc < index->cnt) {				lcs->begin1 = as;				lcs->begin2 = bs;				lcs->end1 = ae;				lcs->end2 = be;				index->cnt = rc;			}			if (np == 0)				break;			while (np <= ae) {				np = NEXT_PTR(index, np);				if (np == 0) {					should_break = 1;					break;				}			}			if (should_break)				break;			as = np;		}	}	return b_next;}
开发者ID:KillTheMule,项目名称:neovim,代码行数:72,


示例14: eval_3OP_Int

/* Process 3OP Integer instructions */bool eval_3OP_Int(struct lilith* vm, struct Instruction* c){	#ifdef DEBUG	char Name[20] = "ILLEGAL_3OP";	#endif	switch(c->raw_XOP)	{		case 0x000: /* ADD */		{			#ifdef DEBUG			strncpy(Name, "ADD", 19);			#elif TRACE			record_trace("ADD");			#endif			ADD(vm, c);			break;		}		case 0x001: /* ADDU */		{			#ifdef DEBUG			strncpy(Name, "ADDU", 19);			#elif TRACE			record_trace("ADDU");			#endif			ADDU(vm, c);			break;		}		case 0x002: /* SUB */		{			#ifdef DEBUG			strncpy(Name, "SUB", 19);			#elif TRACE			record_trace("SUB");			#endif			SUB(vm, c);			break;		}		case 0x003: /* SUBU */		{			#ifdef DEBUG			strncpy(Name, "SUBU", 19);			#elif TRACE			record_trace("SUBU");			#endif			SUBU(vm, c);			break;		}		case 0x004: /* CMP */		{			#ifdef DEBUG			strncpy(Name, "CMP", 19);			#elif TRACE			record_trace("CMP");			#endif			CMP(vm, c);			break;		}		case 0x005: /* CMPU */		{			#ifdef DEBUG			strncpy(Name, "CMPU", 19);			#elif TRACE			record_trace("CMPU");			#endif			CMPU(vm, c);			break;		}		case 0x006: /* MUL */		{			#ifdef DEBUG			strncpy(Name, "MUL", 19);			#elif TRACE			record_trace("MUL");			#endif			MUL(vm, c);			break;		}		case 0x007: /* MULH */		{			#ifdef DEBUG			strncpy(Name, "MULH", 19);			#elif TRACE			record_trace("MULH");			#endif			MULH(vm, c);			break;		}		case 0x008: /* MULU */		{			#ifdef DEBUG//.........这里部分代码省略.........
开发者ID:oriansj,项目名称:stage0,代码行数:101,


示例15: JITDISABLE

void JitArm::fctiwx(UGeckoInstruction inst){	INSTRUCTION_START	JITDISABLE(bJITFloatingPointOff)	u32 b = inst.FB;	u32 d = inst.FD;	ARMReg vB = fpr.R0(b);	ARMReg vD = fpr.R0(d);	ARMReg V0 = fpr.GetReg();	ARMReg V1 = fpr.GetReg();	ARMReg V2 = fpr.GetReg();	ARMReg rA = gpr.GetReg();	ARMReg fpscrReg = gpr.GetReg();	FixupBranch DoneMax, DoneMin;	LDR(fpscrReg, R9, PPCSTATE_OFF(fpscr));	MOVI2R(rA, (u32)minmaxFloat);	// Check if greater than max float	{		VLDR(V0, rA, 8); // Load Max		VCMPE(vB, V0);		VMRS(_PC); // Loads in to APSR		FixupBranch noException = B_CC(CC_LE);		VMOV(vD, V0); // Set to max		SetFPException(fpscrReg, FPSCR_VXCVI);		DoneMax = B();		SetJumpTarget(noException);	}	// Check if less than min float	{		VLDR(V0, rA, 0);		VCMPE(vB, V0);		VMRS(_PC);		FixupBranch noException = B_CC(CC_GE);		VMOV(vD, V0);		SetFPException(fpscrReg, FPSCR_VXCVI);		DoneMin = B();		SetJumpTarget(noException);	}	// Within ranges, convert to integer	// Set rounding mode first	// PPC <-> ARM rounding modes	// 0, 1, 2, 3 <-> 0, 3, 1, 2	ARMReg rB = gpr.GetReg();	VMRS(rA);	// Bits 22-23	BIC(rA, rA, Operand2(3, 5));	LDR(rB, R9, PPCSTATE_OFF(fpscr));	AND(rB, rB, 0x3); // Get the FPSCR rounding bits	CMP(rB, 1);	SetCC(CC_EQ); // zero		ORR(rA, rA, Operand2(3, 5));	SetCC(CC_NEQ);		CMP(rB, 2); // +inf		SetCC(CC_EQ);			ORR(rA, rA, Operand2(1, 5));		SetCC(CC_NEQ);			CMP(rB, 3); // -inf			SetCC(CC_EQ);				ORR(rA, rA, Operand2(2, 5));	SetCC();	VMSR(rA);	ORR(rA, rA, Operand2(3, 5));	VCVT(vD, vB, TO_INT | IS_SIGNED);	VMSR(rA);	gpr.Unlock(rB);	VCMPE(vD, vB);	VMRS(_PC);	SetCC(CC_EQ);		BIC(fpscrReg, fpscrReg, FRFIMask);		FixupBranch DoneEqual = B();	SetCC();	SetFPException(fpscrReg, FPSCR_XX);	ORR(fpscrReg, fpscrReg, FIMask);	VABS(V1, vB);	VABS(V2, vD);	VCMPE(V2, V1);	VMRS(_PC);	SetCC(CC_GT);		ORR(fpscrReg, fpscrReg, FRMask);	SetCC();	SetJumpTarget(DoneEqual);	SetJumpTarget(DoneMax);	SetJumpTarget(DoneMin);	MOVI2R(rA, (u32)&doublenum);	VLDR(V0, rA, 0);	NEONXEmitter nemit(this);	nemit.VORR(vD, vD, V0);	if (inst.Rc) Helper_UpdateCR1(fpscrReg, rA);	STR(fpscrReg, R9, PPCSTATE_OFF(fpscr));	gpr.Unlock(rA);//.........这里部分代码省略.........
开发者ID:Bigorneau,项目名称:dolphin,代码行数:101,


示例16: find_block_motion

/** * Find the most likely shift in motion between two frames for a given * macroblock. Test each block against several shifts given by the rx * and ry attributes. Searches using a simple matrix of those shifts and * chooses the most likely shift by the smallest difference in blocks. */static void find_block_motion(DeshakeContext *deshake, uint8_t *src1,                              uint8_t *src2, int cx, int cy, int stride,                              IntMotionVector *mv){    int x, y;    int diff;    int smallest = INT_MAX;    int tmp, tmp2;    #define CMP(i, j) deshake->c.sad[0](NULL, src1 + cy * stride + cx, /                                        src2 + (j) * stride + (i), stride, /                                        deshake->blocksize)    if (deshake->search == EXHAUSTIVE) {        // Compare every possible position - this is sloooow!        for (y = -deshake->ry; y <= deshake->ry; y++) {            for (x = -deshake->rx; x <= deshake->rx; x++) {                diff = CMP(cx - x, cy - y);                if (diff < smallest) {                    smallest = diff;                    mv->x = x;                    mv->y = y;                }            }        }    } else if (deshake->search == SMART_EXHAUSTIVE) {        // Compare every other possible position and find the best match        for (y = -deshake->ry + 1; y < deshake->ry; y += 2) {            for (x = -deshake->rx + 1; x < deshake->rx; x += 2) {                diff = CMP(cx - x, cy - y);                if (diff < smallest) {                    smallest = diff;                    mv->x = x;                    mv->y = y;                }            }        }        // Hone in on the specific best match around the match we found above        tmp = mv->x;        tmp2 = mv->y;        for (y = tmp2 - 1; y <= tmp2 + 1; y++) {            for (x = tmp - 1; x <= tmp + 1; x++) {                if (x == tmp && y == tmp2)                    continue;                diff = CMP(cx - x, cy - y);                if (diff < smallest) {                    smallest = diff;                    mv->x = x;                    mv->y = y;                }            }        }    }    if (smallest > 512) {        mv->x = -1;        mv->y = -1;    }    emms_c();    //av_log(NULL, AV_LOG_ERROR, "%d/n", smallest);    //av_log(NULL, AV_LOG_ERROR, "Final: (%d, %d) = %d x %d/n", cx, cy, mv->x, mv->y);}
开发者ID:AlexZhangOG,项目名称:FFmpeg,代码行数:71,


示例17: neumann_bc

static inline void neumann_bc(double curvature_motion_part[M][N][P]){	uint32_t i, j, k;	for (j = 0; j < N; j++) {		for (k = 0; k < P; k++) {#pragma AP pipeline			CMP(0, j, k) = CMP(1, j, k);			CMP(M - 1, j, k) = CMP(M - 2, j, k);		}	}	for (i = 0; i < M; i++) {		for (k = 0; k < P; k++) {#pragma AP pipeline			CMP(i, 0, k) = CMP(i, 1, k);			CMP(i, N - 1, k) = CMP(i, N - 2, k);		}	}	for (i = 0; i < M; i++) {		for (j = 0; j < N; j++) {#pragma AP pipeline			CMP(i, j, 0) = CMP(i, j, 1);			CMP(i, j, P - 1) = CMP(i, j, P - 2);		}	}	CMP(0, 0, 0) = CMP(1, 1, 1);	CMP(M - 1, 0, 0) = CMP(M - 2, 1, 1);	CMP(0, N - 1, 0) = CMP(1, N - 2, 1);	CMP(0, 0, P - 1) = CMP(1, 1, P - 2);	CMP(M - 1, N - 1, 0) = CMP(M - 2, N - 2, 1);	CMP(M - 1, 0, P - 1) = CMP(M - 2, 1, P - 2);	CMP(0, N - 1, P - 1) = CMP(1, N - 2, P - 2);	CMP(M - 1, N - 1, P - 1) = CMP(M - 2, N - 2, P - 2);}
开发者ID:intervigilium,项目名称:cs259-project,代码行数:36,


示例18: two_phase_3d_op_explicit

//.........这里部分代码省略.........				stencil[1][1][1] = stencil[1][1][2];				stencil[1][2][1] = stencil[1][2][2];				stencil[1][0][2] = PHI(i, j - 1, k + 1);				stencil[1][1][2] = PHI(i, j, k + 1);				stencil[1][2][2] = PHI(i, j + 1, k + 1);				stencil[2][0][0] = stencil[2][0][1];				stencil[2][1][0] = stencil[2][1][1];				stencil[2][2][0] = stencil[2][2][1];				stencil[2][0][1] = stencil[2][0][2];				stencil[2][1][1] = stencil[2][1][2];				stencil[2][2][1] = stencil[2][2][2];				stencil[2][0][2] = PHI(i + 1, j - 1, k + 1);				stencil[2][1][2] = PHI(i + 1, j, k + 1);				stencil[2][2][2] = PHI(i + 1, j + 1, k + 1);				/* regular calculation here */				Dx_p =				    (stencil[2][1][1] - stencil[1][1][1]) / dx;				Dx_m =				    (stencil[1][1][1] - stencil[0][1][1]) / dx;				Dy_p =				    (stencil[1][2][1] - stencil[1][1][1]) / dy;				Dy_m =				    (stencil[1][1][1] - stencil[1][0][1]) / dy;				Dz_p =				    (stencil[1][1][2] - stencil[1][1][1]) / dz;				Dz_m =				    (stencil[1][1][1] - stencil[1][1][0]) / dz;				Dx_0 =				    (stencil[2][1][1] - stencil[0][1][1]) / dx2;				Dy_0 =				    (stencil[1][2][1] - stencil[1][0][1]) / dy2;				Dz_0 =				    (stencil[1][1][2] - stencil[1][1][0]) / dz2;				Dxx = (Dx_p - Dx_m) / dx;				Dyy = (Dy_p - Dy_m) / dy;				Dzz = (Dz_p - Dz_m) / dz;				Dxy =				    (stencil[2][2][1] - stencil[2][0][1] -				     stencil[0][2][1] -				     stencil[0][0][1]) / (4 * dx * dy);				Dxz =				    (stencil[2][1][2] - stencil[2][1][0] -				     stencil[0][1][2] +				     stencil[0][1][0]) / (4 * dx * dz);				Dyz =				    (stencil[1][2][2] - stencil[1][2][0] -				     stencil[1][0][2] +				     stencil[1][0][0]) / (4 * dy * dz);				Grad = (SQR(Dx_0) + SQR(Dy_0) + SQR(Dz_0));				denom = Grad;				/* denom = denom^1.5 */				for (l = 0; l < 3; l++) {#pragma AP unroll					denom *= denom;				}				q3_sqrt(denom);				numer = (Dx_0 * Dx_0 * Dyy -					 2.0 * Dx_0 * Dy_0 * Dxy +					 Dy_0 * Dy_0 * Dxx + Dx_0 * Dx_0 * Dzz -					 2.0 * Dx_0 * Dz_0 * Dxz +					 Dz_0 * Dz_0 * Dxx + Dy_0 * Dy_0 * Dzz -					 2.0 * Dy_0 * Dz_0 * Dyz +					 Dz_0 * Dz_0 * Dyy);				K = numer / denom;				CMP(i, j, k) =				    Grad * (mu * K +					    lambda1 * (U0(i, j, k) -						       c1) * (U0(i, j,								 k) - c1) -					    lambda2 * (U0(i, j, k) -						       c2) * (U0(i, j,								 k) - c2));			}		}	}	neumann_bc(curvature_motion_part);	for (k = 0; k < P; k++) {		for (j = 0; j < N; j++) {			for (i = 0; i < M; i++) {#pragma AP pipeline				PHI(i, j, k) += CMP(i, j, k) * dt;			}		}	}}
开发者ID:intervigilium,项目名称:cs259-project,代码行数:101,


示例19: ALU

   ALU(ADDRY, eor),        // 0x56   ALU(IDPY, eor),         // 0x57   ALU(DP_IMM, eor),       // 0x58   ALU(DPX_DPY, eor),      // 0x59   ALUW(cmpw),             // 0x5a   RMW(DPIX, lsr),         // 0x5b   RMW(A, lsr),            // 0x5c   MOVE(X, a),             // 0x5d   ALUXY(y, addr),         // 0x5e   smp_op_jmp,             // 0x5f   smp_op_clrc,            // 0x60   TCALL(6),               // 0x61   SET1(3),                // 0x62   BBS(3),                 // 0x63   CMP(a, dp),             // 0x64   CMP(a, addr),           // 0x65   CMP(a, dpx),            // 0x66   CMP(a, idpx),           // 0x67   CMP(a, const),          // 0x68   CMP(dp, dp),            // 0x69   ALU(BIT, andn1),        // 0x6a   RMW(DP, ror),           // 0x6b   RMW(ADDR, ror),         // 0x6c   smp_op_push_y,          // 0x6d   smp_op_dbnz_dp,         // 0x6e   smp_op_ret,             // 0x6f   BRANCH(v),              // 0x70   TCALL(7),               // 0x71   CLR1(3),                // 0x72
开发者ID:Themaister,项目名称:SSNES-core,代码行数:31,


示例20: string2TextureFormat

	TextureFormat string2TextureFormat(const char *str)	{#define CMP(fmt, shrt) if (!strcmp_cns(str, #fmt) || (shrt && !strcmp_cns(str, shrt))) return TF_##fmt        CMP(A8, 0);		CMP(L8, 0);		CMP(A8L8, 0);		CMP(R8G8B8, "888");		CMP(R8G8B8A8, "8888");		CMP(R5G5B5A1, "5551");		CMP(R4G4B4A4, "4444");		CMP(R5G6B5, "565");		CMP(PVRTC_2RGB, 0);		CMP(PVRTC_2RGBA, 0);		CMP(PVRTC_4RGB, 0);		CMP(PVRTC_4RGBA, 0);		CMP(PVRTCII_2, 0);		CMP(PVRTCII_4, 0);		CMP(ETC1, 0);#undef  CMP		OX_ASSERT(!"string2TextureFormat undefined format");		return TF_UNDEFINED;	}
开发者ID:gotonis,项目名称:danmake,代码行数:22,


示例21: setMainTimestamp

//.........这里部分代码省略.........                /* ADC  */            case 0x69:  ADC( adRdIm() );                break;            case 0x65:  ADC( adRdZp() );                break;            case 0x75:  ADC( adRdZx() );                break;            case 0x6D:  ADC( adRdAb() );                break;            case 0x7D:  ADC( adRdAx() );                break;            case 0x79:  ADC( adRdAy() );                break;            case 0x61:  ADC( adRdIx() );                break;            case 0x71:  ADC( adRdIy() );                break;                                /* AND  */            case 0x29:  AND( adRdIm() );                break;            case 0x25:  AND( adRdZp() );                break;            case 0x35:  AND( adRdZx() );                break;            case 0x2D:  AND( adRdAb() );                break;            case 0x3D:  AND( adRdAx() );                break;            case 0x39:  AND( adRdAy() );                break;            case 0x21:  AND( adRdIx() );                break;            case 0x31:  AND( adRdIy() );                break;                /* ASL  */            case 0x0A:  adImplied();    ASL(cpu.A);     break;            case 0x06:  adRWZp( &Cpu::ASL );            break;            case 0x16:  adRWZx( &Cpu::ASL );            break;            case 0x0E:  adRWAb( &Cpu::ASL );            break;            case 0x1E:  adRWAx( &Cpu::ASL );            break;                /* BIT  */            case 0x24:  BIT( adRdZp() );                break;            case 0x2C:  BIT( adRdAb() );                break;                                /* CMP  */            case 0xC9:  CMP( adRdIm() );                break;            case 0xC5:  CMP( adRdZp() );                break;            case 0xD5:  CMP( adRdZx() );                break;            case 0xCD:  CMP( adRdAb() );                break;            case 0xDD:  CMP( adRdAx() );                break;            case 0xD9:  CMP( adRdAy() );                break;            case 0xC1:  CMP( adRdIx() );                break;            case 0xD1:  CMP( adRdIy() );                break;                                /* CPX  */            case 0xE0:  CPX( adRdIm() );                break;            case 0xE4:  CPX( adRdZp() );                break;            case 0xEC:  CPX( adRdAb() );                break;                                /* CPY  */            case 0xC0:  CPY( adRdIm() );                break;            case 0xC4:  CPY( adRdZp() );                break;            case 0xCC:  CPY( adRdAb() );                break;                                /* DEC  */            case 0xCA:  adImplied();    DEC(cpu.X);     break;  /* DEX  */            case 0x88:  adImplied();    DEC(cpu.Y);     break;  /* DEY  */            case 0xC6:  adRWZp( &Cpu::DEC );            break;            case 0xD6:  adRWZx( &Cpu::DEC );            break;            case 0xCE:  adRWAb( &Cpu::DEC );            break;            case 0xDE:  adRWAx( &Cpu::DEC );            break;                                /* EOR  */            case 0x49:  EOR( adRdIm() );                break;            case 0x45:  EOR( adRdZp() );                break;            case 0x55:  EOR( adRdZx() );                break;            case 0x4D:  EOR( adRdAb() );                break;            case 0x5D:  EOR( adRdAx() );                break;
开发者ID:BenWenger,项目名称:Schpune,代码行数:67,


示例22: avx_test

static voidavx_test (){    __m256d source1, source2, dest;    int i;    CMP(_CMP_EQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);    CMP(_CMP_LT_OS, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);    CMP(_CMP_LE_OS, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);    CMP(_CMP_UNORD_Q, isunordered(s1[i], s2[i]));    CMP(_CMP_NEQ_UQ, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);    CMP(_CMP_NLT_US, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);    CMP(_CMP_NLE_US, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);    CMP(_CMP_ORD_Q, !isunordered(s1[i], s2[i]));    CMP(_CMP_EQ_UQ, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);    CMP(_CMP_NGE_US, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);    CMP(_CMP_NGT_US, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);    CMP(_CMP_FALSE_OQ, 0);    CMP(_CMP_NEQ_OQ, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);    CMP(_CMP_GE_OS, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);    CMP(_CMP_GT_OS, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);    CMP(_CMP_TRUE_UQ, 1);    CMP(_CMP_EQ_OS, !isunordered(s1[i], s2[i]) && s1[i] == s2[i]);    CMP(_CMP_LT_OQ, !isunordered(s1[i], s2[i]) && s1[i] < s2[i]);    CMP(_CMP_LE_OQ, !isunordered(s1[i], s2[i]) && s1[i] <= s2[i]);    CMP(_CMP_UNORD_S, isunordered(s1[i], s2[i]));    CMP(_CMP_NEQ_US, isunordered(s1[i], s2[i]) || s1[i] != s2[i]);    CMP(_CMP_NLT_UQ, isunordered(s1[i], s2[i]) || s1[i] >= s2[i]);    CMP(_CMP_NLE_UQ, isunordered(s1[i], s2[i]) || s1[i] > s2[i]);    CMP(_CMP_ORD_S, !isunordered(s1[i], s2[i]));    CMP(_CMP_EQ_US, isunordered(s1[i], s2[i]) || s1[i] == s2[i]);    CMP(_CMP_NGE_UQ, isunordered(s1[i], s2[i]) || s1[i] < s2[i]);    CMP(_CMP_NGT_UQ, isunordered(s1[i], s2[i]) || s1[i] <= s2[i]);    CMP(_CMP_FALSE_OS, 0);    CMP(_CMP_NEQ_OS, !isunordered(s1[i], s2[i]) && s1[i] != s2[i]);    CMP(_CMP_GE_OQ, !isunordered(s1[i], s2[i]) && s1[i] >= s2[i]);    CMP(_CMP_GT_OQ, !isunordered(s1[i], s2[i]) && s1[i] > s2[i]);    CMP(_CMP_TRUE_US, 1);}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:43,


示例23: switch

void Jit::Comp_FPU2op(u32 op){	CONDITIONAL_DISABLE;	int fs = _FS;	int fd = _FD;	// logBlocks = 1;	switch (op & 0x3f) 	{	case 4:	//F(fd)	   = sqrtf(F(fs));            break; //sqrt		fpr.MapDirtyIn(fd, fs);		VSQRT(fpr.R(fd), fpr.R(fs));		break;	case 5:	//F(fd)    = fabsf(F(fs));            break; //abs		fpr.MapDirtyIn(fd, fs);		VABS(fpr.R(fd), fpr.R(fs));		break;	case 6:	//F(fd)	   = F(fs);                   break; //mov		fpr.MapDirtyIn(fd, fs);		VMOV(fpr.R(fd), fpr.R(fs));		break;	case 7:	//F(fd)	   = -F(fs);                  break; //neg		fpr.MapDirtyIn(fd, fs);		VNEG(fpr.R(fd), fpr.R(fs));		break;	case 12: //FsI(fd) = (int)floorf(F(fs)+0.5f); break; //round.w.s		fpr.MapDirtyIn(fd, fs);		VCVT(fpr.R(fd), fpr.R(fs), TO_INT | IS_SIGNED);		break;	case 13: //FsI(fd) = Rto0(F(fs)));            break; //trunc.w.s		fpr.MapDirtyIn(fd, fs);		VCVT(fpr.R(fd), fpr.R(fs), TO_INT | IS_SIGNED | ROUND_TO_ZERO);		break;	case 14: //FsI(fd) = (int)ceilf (F(fs));      break; //ceil.w.s		fpr.MapDirtyIn(fd, fs);		MOVI2F(S0, 0.5f, R0);		VADD(S0,fpr.R(fs),S0);		VCVT(fpr.R(fd), S0,        TO_INT | IS_SIGNED);		break;	case 15: //FsI(fd) = (int)floorf(F(fs));      break; //floor.w.s		fpr.MapDirtyIn(fd, fs);		MOVI2F(S0, 0.5f, R0);		VSUB(S0,fpr.R(fs),S0);		VCVT(fpr.R(fd), S0,        TO_INT | IS_SIGNED);		break;	case 32: //F(fd)   = (float)FsI(fs);          break; //cvt.s.w		fpr.MapDirtyIn(fd, fs);		VCVT(fpr.R(fd), fpr.R(fs), TO_FLOAT | IS_SIGNED);		break;	case 36: //FsI(fd) = (int)  F(fs);            break; //cvt.w.s		fpr.MapDirtyIn(fd, fs);		LDR(R0, CTXREG, offsetof(MIPSState, fcr31));		AND(R0, R0, Operand2(3));		// MIPS Rounding Mode:		//	 0: Round nearest		//	 1: Round to zero		//	 2: Round up (ceil)		//	 3: Round down (floor)		CMP(R0, Operand2(2));		SetCC(CC_GE); MOVI2F(S0, 0.5f, R1);		SetCC(CC_GT); VSUB(S0,fpr.R(fs),S0);		SetCC(CC_EQ); VADD(S0,fpr.R(fs),S0);		SetCC(CC_GE); VCVT(fpr.R(fd), S0, TO_INT | IS_SIGNED); /* 2,3 */		SetCC(CC_AL);		CMP(R0, Operand2(1));		SetCC(CC_EQ); VCVT(fpr.R(fd), fpr.R(fs), TO_INT | IS_SIGNED | ROUND_TO_ZERO); /* 1 */		SetCC(CC_LT); VCVT(fpr.R(fd), fpr.R(fs), TO_INT | IS_SIGNED); /* 0 */		SetCC(CC_AL);		break;	default:		DISABLE;	}}
开发者ID:jack00,项目名称:ppsspp,代码行数:74,


示例24: main

//.........这里部分代码省略.........				printf("%d valor del resultado bandera v /n",banderas[V]);			break;						case 5:				printf("ingrese el valor del registro origen:/n");				scanf("%d",&registro[1]);								MOV(registro,&registro[0],registro[1],banderas);								printf("%d valor del resultado /n",registro[0]);			break;						case 7:				printf("ingrese el valor del primer registro:/n");				scanf("%d",&registro[1]);				printf("ingrese el valor del segundo registro:/n");				scanf("%d",&registro[2]);								CMN(registro,registro[1],registro[2],&banderas[0]);								printf("%d valor del resultado /n",registro[0]);				printf("%d valor del resultado bandera n /n",banderas[N]);				printf("%d valor del resultado bandera z /n",banderas[Z]);				printf("%d valor del resultado bandera c /n",banderas[C]);				printf("%d valor del resultado bandera v /n",banderas[V]);			break;						case 8:				printf("ingrese el valor del primer registro:/n");				scanf("%d",&registro[1]);				printf("ingrese el valor del segundo registro:/n");				scanf("%d",&registro[2]);								CMP(registro,registro[1],registro[2],&banderas[0]);								printf("%d valor del resultado /n",registro[0]);				printf("%d valor del resultado bandera n /n",banderas[N]);				printf("%d valor del resultado bandera z /n",banderas[Z]);				printf("%d valor del resultado bandera c /n",banderas[C]);				printf("%d valor del resultado bandera v /n",banderas[V]);			break;						case 9:							printf("ingrese el valor del primer registro:/n");				scanf("%d",&registro[1]);				printf("ingrese el valor del segundo registro:/n");				scanf("%d",&registro[2]);								MUL(registro,&registro[0],registro[1],registro[2],&banderas[0]);								printf("%d valor del resultado /n",registro[0]);				printf("%d valor del resultado bandera n /n",banderas[N]);				printf("%d valor del resultado bandera z /n",banderas[Z]);				printf("%d valor del resultado bandera c /n",banderas[C]);				printf("%d valor del resultado bandera v /n",banderas[V]);			break;						case 10:							printf("ingrese el valor del primer registro:/n");				scanf("%d",&registro[1]);				printf("ingrese el valor del segundo registro:/n");				scanf("%d",&registro[2]);								TST(registro,registro[1],registro[2],&banderas[0]);								printf("%d valor del resultado /n",registro[0]);
开发者ID:andresbmth,项目名称:Trabajo_1_Micros,代码行数:67,


示例25: OP1

#ifdef SUPPORT_UCPif (common->use_ucp)  {  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);  jump = CMP(SLJIT_C_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);  add_jump(compiler, &common->getucd, JUMP(SLJIT_FAST_CALL));  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Ll);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_Lu - ucp_Ll);  OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_UNUSED, 0, SLJIT_C_LESS_EQUAL);  OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ucp_Nd - ucp_Ll);  OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, ucp_No - ucp_Nd);  OP_FLAGS(SLJIT_OR, TMP2, 0, TMP2, 0, SLJIT_C_LESS_EQUAL);  JUMPHERE(jump);  }else#endif  {#ifndef COMPILE_PCRE8  /* TMP2 may be destroyed by peek_char. */  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);  jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);#elif defined SUPPORT_UTF  OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);  jump = NULL;  if (common->utf)    jump = CMP(SLJIT_C_GREATER, TMP1, 0, SLJIT_IMM, 255);#endif  OP1(SLJIT_MOV_UB, TMP2, 0, SLJIT_MEM1(TMP1), common->ctypes);  OP2(SLJIT_LSHR, TMP2, 0, TMP2, 0, SLJIT_IMM, 4 /* ctype_word */);  OP2(SLJIT_AND, TMP2, 0, TMP2, 0, SLJIT_IMM, 1);#ifndef COMPILE_PCRE8
开发者ID:antoniocorreia,项目名称:cprojects,代码行数:31,



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


C++ CMPASSERT函数代码示例
C++ CMOS_WRITE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。