No difference on my machine



Comparing 'xor eax, eax' with 'mov eax, 0' from the CLAX thread:

; nasm -f elf -o timeit.o timeit.asm
; gcc -s -o timeit timeit.o

extern exit
extern printf

global main

section .data

tvsec dd 0
tvusec dd 0
tz1 dd 1
tz2 dd 0
secs db "Sec: %i", 10, 0
store dd 0

section .text

main:

mov eax, 78 ; gettimeofday
mov ebx, tvsec
mov edx, tz1
int 0x80

mov eax, DWORD [tvsec]
mov DWORD [store], eax

mov ecx, 2
mainloop:
mov edx, -1
subloop:
xor eax, eax ; exchange with 'mov eax, 0'
dec edx
jnz subloop

dec ecx
jnz mainloop

mov eax, 78
mov ebx, tvsec
mov edx, tz1
int 0x80

mov eax, DWORD [tvsec]
sub eax, DWORD [store]

push eax
push secs
call printf

push 0
call exit

Nathan.

.



Relevant Pages