On 9/24/13 12:16 AM, Paul Eggert wrote: > ------------------------------------------------------------ > revno: 114450 > revision-id: eggert@cs.ucla.edu-20130924071638-9k6809ka6hbocr2n > parent: dmantipov@yandex.ru-20130924064320-9o1cx41btsnt1voo > committer: Paul Eggert > branch nick: trunk > timestamp: Tue 2013-09-24 00:16:38 -0700 > message: > * dispnew.c (clear_glyph_row, copy_row_except_pointers): > > Prefer signed to unsigned integers where either will do. Why? Signed integers have undefined overflow behavior and sometimes result in less efficient code. If anything, we should prefer unsigned integer types. int with_signed (int arg) { return arg/64; } unsigned with_unsigned (unsigned arg) { return arg/64; } $ gcc-mp-4.7 -O2 -march=core2 foo.c $ gdb a.out Reading symbols for shared libraries ... done (gdb) disassemble with_signed Dump of assembler code for function with_signed: 0x0000000100000f40 : lea 0x3f(%rdi),%eax 0x0000000100000f43 : test %edi,%edi 0x0000000100000f45 : cmovns %edi,%eax 0x0000000100000f48 : sar $0x6,%eax 0x0000000100000f4b : retq 0x0000000100000f4c : nopl 0x0(%rax) End of assembler dump. (gdb) disassemble with_unsigned Dump of assembler code for function with_unsigned: 0x0000000100000f50 : mov %edi,%eax 0x0000000100000f52 : shr $0x6,%eax 0x0000000100000f55 : retq End of assembler dump.