本文介绍了触发输出一点一点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我看到了一个演示代码,通过使用这两个符号,可以将触发输出的功能从一个字节一个字节地变为另一个字节, | =和&= 我不知道它的功能是什么..导致我无法从google〜
hello, i saw a demo code which change the function of trigger output from byte by byte to bit by bit, by using both of this symbol, |= and &= i wonder what is the function of it.. cause i cant find any solution from google~
推荐答案要设置x,请使用以下功能: Hi, to set a bit x, use this functionality: number |= 1 << x;
要清除x,请使用以下代码:
to clear a bit x, use this code:
number &= ~(1 << x);要切换x,请使用以下代码:
to toggle a bit x, use this code:
number ^= 1 << x;请参阅此处以获得说明: www.cprogramming/tutorial/bitwise_operators.html [ ^ ]
See here for an explanation: www.cprogramming/tutorial/bitwise_operators.html[^]
更多推荐
触发输出一点一点
发布评论