KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Variable x is int with possible values: -1, 0, 1, 2, 3 . Which expression will be faster (in CPU ticks): 1. (x < 0) 2. (x == -1) Language: C/C++, but I suppose all other languages will have the same. P.S. I personally think that answer is (x < 0) . More widely for gurus: what if x from -1 to 2^30 ?
Tags (comma-separated)
Save Edits
Cancel