Hi, Myrk, :-)
On May 30, 4:38 pm, Johann 'Myrkraverk' Oskarsson
Perhaps he shouldn't have said "trivial". It can be, but of course
real life tends to lean towards complexity.
But yes, for a few simple examples, see below (and the NOPs were just
to separate things for clarity):
B800000000 mov eax,0x0 ; 5 bytes
90 nop
9C pushfd ; 1+2+1 bytes
31C0 xor eax,eax
9D popfd
90 nop
90 nop
B8FFFFFFFF mov eax,0xffffffff ; 5 bytes
90 nop
31C0 xor eax,eax ; 2+1 bytes
48 dec eax
90 nop
90 nop
83C602 add esi,byte +0x2 ; 3 bytes
90 nop
46 inc esi ; 1+1 bytes
46 inc esi
90 nop
90 nop
And for reference, the max instruction size for 8086 was 6 bytes, 286
was 10 bytes, and 386 was 15 bytes (if that tells you anything).
P.S. Keep in mind that "most" people (and compilers) don't optimize
much for size, only for speed.