Question: > 
> **Possible Duplicate:**  
> 
> [performance of unsigned vs signed integers](https://stackoverflow.com/questions/4712315/performance-of-unsigned-vs-signed-integers) 
> 
> 
> 

I have read somewhere that it's a tiny bit faster on `x86_64` to compare `signed ints` in `C/C++` compared to `unsigned ints`, e.g. `for (int i...`) is "faster" than `for (uint i...)`.

Is that true? Why is that true? I know the difference is super small, but anyway.

Answer: 
Maybe in some cases, signed integers force the compiler to sign-extend them.  

If you move an integer to `eax`, then the high bits of `rax` are set to zeros (the low bits are the bits of `eax`). If it's an integer, you need to set the high 32 bits to the sign of the low 32 bits. It's one extra instruction.

I'm not sure this sign extension is needed in a simple `for (i=0; i<MAX; i++)`.
There should be no difference in speed.
The comparison instruction (CMP) on x86 32/64 is the same on both signed and unsigned integer data types.
All of the branching instructions (jxx) and conditional moves (cmovxx) work by testing the CPU flags changed by CMP.
Increments, decrements, addictions, subtractions on integer data are also not aware of signed or unsigned data types (due to the 2 complement).