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

C++ CMP函数代码示例

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

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



在下文中一共展示了CMP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:karatsuba.c


示例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,代码来源:optestutilities.c


示例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,代码来源:erl_monitors.c


示例4: check_crc

/* detect if a block is used in a particular pattern */
static int
check_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,代码来源:deattack.c


示例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,代码来源:fft_test.cpp


示例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,代码来源:heap.c


示例7: qsort_chk

/* Verify anti-symmetry and transitivity for comparator CMP on sorted array
   of N SIZE-sized elements pointed to by BASE.  */
void
qsort_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,代码来源:vec.c


示例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,代码来源:file.c


示例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,代码来源:Jit.cpp


示例10: conf_sort

static int
conf_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,代码来源:conf.c


示例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,代码来源:hashset.c


示例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,代码来源:Test.cpp


示例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,代码来源:xhistogram.c


示例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,代码来源:vm_decode.c


示例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,代码来源:JitArm_FloatingPoint.cpp


示例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,代码来源:vf_deshake.c


示例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,代码来源:twophase.c


示例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,代码来源:twophase.c


示例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,代码来源:table.c


示例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,代码来源:ImageData.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ CMPASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ CMOS_WRITE函数代码示例发布时间: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