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

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

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

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

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

示例1: X64

	X64() : CodeGenerator(true)	{		prologue(0);		static __int64 x;		// Simple operations		mov(r10, r11);		mov(r0, r1);		mov(r0d, r1d);		mov(r0b, r1b);		xor(rax, rax);		xor(rbx, rbx);		mov(qword_ptr [&x+rax+4*rbx], 1);		mov(qword_ptr [&x], 2);   // RIP-relative addressing		push(r14);		pop(r14);		const char *string = "Good luck with your 64-bit processor!";		mov(rcx, (unsigned int)string);		call((unsigned int)printf);		epilogue();	}
开发者ID:Deji69,项目名称:softwire,代码行数:25,


示例2: includeError2

voidincludeError2 (char *string, int size){  int i = 0;  int exponent = 0;  unsigned char mask = '/0';  for (i = 0; i < size; i++)  {    if (drand48 () < ERROR_RATE)    {      exponent = floor (drand48 () * 16);      if (exponent < 8)      {		mask = 1 << exponent;		string[i] = xor (string[i], mask);      }      else      {		mask = 1 << (exponent - 8);		string[i + 1] = xor (string[i + 1], mask);      }    }  }  return;}
开发者ID:KaneRoot,项目名称:public,代码行数:28,


示例3: main

/* Driver program to test above functions */int main(){    int T = 0;    int n[10] = {0};     //int n = 4;    int res = 0 ,first = 1 ;    scanf("%d",&T);        for(int j=0;j<T;j++){        scanf("%d",&n[j]);            for(int i=0;i<n[j];i++) {          scanf("%d",&arr[j][i]);        }    }        for(int k=0;k<T;k++) {  res = 0; first = 1;  for(int j=1;j<=n[k];j++) {    for(int i=1;i<=(n[k]-j)+1;i++)    {      if(first) {        res =  xor(i,j,k); first = 0 ;continue;      }      res = res ^ xor(i,j,k);    }  }    printf("%d/n",res);}  return 0;}
开发者ID:rupeshsjce,项目名称:C-CODE,代码行数:36,


示例4: crypto_cbc_decrypt_inplace

static int crypto_cbc_decrypt_inplace(struct blkcipher_desc *desc,				      struct blkcipher_walk *walk,				      struct crypto_cipher *tfm,				      void (*xor)(u8 *, const u8 *,						  unsigned int)){	void (*fn)(struct crypto_tfm *, u8 *, const u8 *) =		crypto_cipher_alg(tfm)->cia_decrypt;	int bsize = crypto_cipher_blocksize(tfm);	unsigned long alignmask = crypto_cipher_alignmask(tfm);	unsigned int nbytes = walk->nbytes;	u8 *src = walk->src.virt.addr;	u8 stack[bsize + alignmask];	u8 *first_iv = (u8 *)ALIGN((unsigned long)stack, alignmask + 1);	memcpy(first_iv, walk->iv, bsize);	/* Start of the last block. */	src += nbytes - nbytes % bsize - bsize;	memcpy(walk->iv, src, bsize);	for (;;) {		fn(crypto_cipher_tfm(tfm), src, src);		if ((nbytes -= bsize) < bsize)			break;		xor(src, src - bsize, bsize);		src -= bsize;	}	xor(src, first_iv, bsize);	return nbytes;}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:33,


示例5: xor

long long int xor(long long int a[],long long int i,long long int ans){	if(i<0)		return ans;	else		return max(xor(a,i-1,ans),xor(a,i-1,ans^a[i]));}
开发者ID:akashrajravi,项目名称:Codes,代码行数:7,


示例6: cts_dec

static voidcts_dec (unsigned char *out, unsigned char *in, unsigned char *iv,	 unsigned int len){    int r;    unsigned int len2;    unsigned char pn1[B], pn[B], cn[B], cn1[B];    if (len < B + 1) abort ();    len2 = (len - B - 1) & ~(B-1);    cbc_dec (out, in, iv, len2);    out += len2;    in += len2;    len -= len2;    if (len2)	iv = in - B;    if (len <= B || len > 2 * B)	abort ();    memcpy (cn1, in, B);    r = camellia_dec_blk (cn1, pn, &dctx);    if (!r) fprintf(stderr, "error, line %d/n", __LINE__), exit(1);    memset (cn, 0, sizeof(cn));    memcpy (cn, in+B, len-B);    xor (pn, pn, cn);    memcpy (cn+len-B, pn+len-B, 2*B-len);    r = camellia_dec_blk (cn, pn1, &dctx);    if (!r) fprintf(stderr, "error, line %d/n", __LINE__), exit(1);    xor (pn1, pn1, iv);    memcpy(out, pn1, B);    memcpy(out+B, pn, len-B);}
开发者ID:davidben,项目名称:krb5,代码行数:32,


示例7: fullAdder

void fullAdder (char a, char b, char ci, char & co, char & sum){	char axb, ab, abc;	axb = xor (a, b);	ab  = and (a, b);	abc = and (axb, ci);	co = or (ab, abc);	sum = xor (axb, ci);}
开发者ID:CarlosPlusPlus,项目名称:wpi-grad,代码行数:10,


示例8: switch

void GSDrawScanlineCodeGenerator::WritePixel(const Xmm& src, const Xmm& temp, const Reg32& addr, uint8 i, int psm){    static const int offsets[4] = {0, 2, 8, 10};    Address dst = ptr[addr * 2 + (size_t)m_env.vm + offsets[i] * 2];    if(m_cpu.has(util::Cpu::tSSE41))    {        switch(psm)        {        case 0:            if(i == 0) movd(dst, src);            else pextrd(dst, src, i);            break;        case 1:            if(i == 0) movd(eax, src);            else pextrd(eax, src, i);            xor(eax, dst);            and(eax, 0xffffff);            xor(dst, eax);            break;        case 2:            pextrw(eax, src, i * 2);            mov(dst, ax);            break;        }    }    else    {        switch(psm)        {        case 0:            if(i == 0) movd(dst, src);            else {                pshufd(temp, src, _MM_SHUFFLE(i, i, i, i));                movd(dst, temp);            }            break;        case 1:            if(i == 0) movd(eax, src);            else {                pshufd(temp, src, _MM_SHUFFLE(i, i, i, i));                movd(eax, temp);            }            xor(eax, dst);            and(eax, 0xffffff);            xor(dst, eax);            break;        case 2:            pextrw(eax, src, i * 2);            mov(dst, ax);            break;        }    }}
开发者ID:mauzus,项目名称:progenitor,代码行数:55,


示例9: permutar

///Cargar el vector con las posibles permutacionesvoid permutar(funciones *donde, char *cadena, int inicio){	int j;	int fin = strlen(cadena);	if(inicio==fin){ //Si ya diste tod0 vuelta		donde->datos[donde->puntero++] = strdup(cadena); //el cpy y malloc	}else{		for(j=inicio; j<= fin; j++){			xor((cadena+inicio), (cadena+j));			permutar(donde, cadena, inicio+1);			xor((cadena+inicio), (cadena+j)); //rollback		}	}}
开发者ID:jazcarate,项目名称:md-avenger,代码行数:14,


示例10: fulladder

sum_carry fulladder(int a, int b, int cin) {   int x0, x1, a0, a1, o0;   sum_carry sc;   x0 = xor(a, b);   x1 = xor(x0, cin);   a0 = and(cin, x0);   a1 = and(a,b);   o0 = or(a0, a1);   sc.sum = x1;   sc.carry = o0;   return sc;}
开发者ID:aklt,项目名称:Ekstreme-multiprogramming-report,代码行数:14,


示例11: _insert

//将结点n插入到pre和next之间void _insert(struct node *pre, struct node *next, struct node *p) {	struct node *tmp;	p->LR = xor(pre, next);	if(pre != NULL) {		tmp = xor(next, pre->LR); //tmp记录pre的前面的		pre->LR = xor(p, tmp);	}	if(next != NULL) {		tmp = xor(pre, next->LR); //tmp记录next的后面的		next->LR = xor(p, tmp);	}}
开发者ID:tiancaiamao,项目名称:datastruct,代码行数:16,


示例12: main

/*----------------------------------------------------------------------------- * FUNCTION:    main  *  * DATE:        June 4, 2010 *  * REVISIONS:    *  * DESIGNER:    Steffen L. Norgren <[email
C++ xorbuf函数代码示例
C++ xopen函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。