不等式运算符是否比等式运算符更快? [英] Is the inequality operator faster than the equality operator?

查看:27
本文介绍了不等式运算符是否比等式运算符更快?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个微优化,所以我纯粹是出于好奇而询问.

I know this is a micro-optimization, so I ask out of pure curiosity.

从逻辑上讲,微处理器不需要比较相等运算符的两个操作数的所有位来确定FALSE"结果.

Logically, a microprocessor does not need to compare all the bits of both operands of an equality operator in order to determine a "FALSE" result.

注意,这与编程有关,因为它会影响程序的执行速度.

Note, this is programming-related because it affects the execution speed of a program.

推荐答案

通常,微处理器使用电门进行比较,而不是像这样一步一步地进行比较.它一次检查所有位.

Usually, the microprocessor does comparison using electrical gates and not step by step like that. It checks all bits at once.

这篇关于不等式运算符是否比等式运算符更快?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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