有位运算还是实用? [英] Are bitwise operations still practical?

查看:113
本文介绍了有位运算还是实用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

维基百科,知识的一个真实来源,指出:

Wikipedia, the one true source of knowledge, states:

在大多数老的微处理器,位
  操作比稍快
  加法和减法运算
  比平常快显著
  乘除
  操作。在现代建筑,
  这种情况并非如此:按位
  操作大致相同
  速度增加(虽然仍然较快
  比乘法)。

On most older microprocessors, bitwise operations are slightly faster than addition and subtraction operations and usually significantly faster than multiplication and division operations. On modern architectures, this is not the case: bitwise operations are generally the same speed as addition (though still faster than multiplication).

是否有实际的原因,了解位运算黑客或者现在就是你学习的理论和好奇心的东西吗?

Is there a practical reason to learn bitwise operation hacks or it is now just something you learn for theory and curiosity?

推荐答案

位运算是值得研究的,因为他们有很多的应用。它的不可以他们的主要替代算术运算的使用。密码学,计算机图形学,散列函数,COM pression算法和网络协议都只是一些例子,按位操作是非常有用的。

Bitwise operations are worth studying because they have many applications. It is not their main use to substitute arithmetic operations. Cryptography, computer graphics, hash functions, compression algorithms, and network protocols are just some examples where bitwise operations are extremely useful.

您从维基百科的文章引述该行只是试图给出关于在速一些端倪位操作即可。不幸的是,文章没有提供应用一些很好的例子。

The lines you quoted from the Wikipedia article just tried to give some clues about the speed of bitwise operations. Unfortunately the article fails to provide some good examples of applications.

这篇关于有位运算还是实用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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