比较两个数字,获得C#中的不同位 [英] comparing two numbers, getting the different bits in C#

查看:66
本文介绍了比较两个数字,获得C#中的不同位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个数字,例如x = 56 = 00111000和y = 50 = 00110010且两个数字中都有两个数字位,我如何通过c#程序找到,请帮帮我.

i have two number e.g, x=56=00111000 and y=50=00110010 and there are two number bits in both numbers, how i find through c# program, kindly help me.
thanks in advance.

推荐答案

例如,如果对它们进行异或,即x ^ y,则设置的位将指示xy位不同.

—SA
For example, if you XOR them, that is, x ^ y, the set bits will indicate the bit positions where x and y bits are different.

—SA


这篇关于比较两个数字,获得C#中的不同位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆