什么会更快,>= 或 >? [英] What will be faster, >= or >?

查看:41
本文介绍了什么会更快,>= 或 >?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 > 是否比 >= 更快?我试图对其进行基准测试,但要么需要 0 毫秒,要么需要永远.我知道差异会非常小,但我必须对很多像素进行操作.有人能告诉我什么更快吗?

I was wondering if > is faster then >= ? I tried to benchmark it but either it takes 0ms or it takes forever. I understand that the difference will be really small but i have to operate on a lot pixels. Can someone tell me what is faster?

推荐答案

两个比较都将被编译为机器指令,如 BLT(分支小于)或 BLE(不相等的分支),它检查一些状态位,如 BLT: NV + -NV(负值 & 不溢出或非负值和溢出)或 BLE: Z + NV + -NV(零或负数 & 不溢出或不负数和溢出).
这些指令通常需要完全相同的时间,因此它们同样快.

Both comparisons will be compiled to machine instructions like BLT (branch on less than) or BLE (branch on less equal), which check some status bits like BLT: N-V + -NV (negative & not overflow or not negative and overflow) or BLE: Z + N-V + -NV (zero or negative & not overflow or not negative and overflow).
These instruction take normally exactly the same time, so they are equally fast.

这篇关于什么会更快,>= 或 >?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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