Блог пользователя shervin

Автор shervin, история, 11 лет назад, По-английски

Hello,
i am just curious, i want to know if we have a bool like X, and if we want to check if it is 0, which if statement is more efficient This->if(!X) or This->if(x^1).(i checked the asm code and the codes were not the same so i think they defer from one another.)
Thanks.

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

can someone give me any reason for the down-votes?
did i write something wrong??
Or everyone in cf is in a bad mood?

»
11 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

I'm not sure about efficiency, but I would definitely go with the first one since it's much more readable, and it doesn't really matter because difference -if there is any- would be negligible.