Discussion:
Could anyone help me re-writing a function with gcc inline-assembly ?
(too old to reply)
Bonita Montero
2020-05-13 06:54:31 UTC
Permalink
I've got this Masm-code:

PUBLIC ?spendCycles@@***@Z
_TEXT SEGMENT
?spendCycles@@***@Z PROC
test rcx, rcx
jz byebye
cycleLoop:
dec rcx ; roughly one jump per clock-cycle
jnz cycleLoop ; because there's only one branch-unit
byebye:
ret
?spendCycles@@***@Z ENDP
_TEXT ENDS
END

I need a C++-function with gcc inline-assembly that does the same.
Unfortunately I'm not familiar with gcc inline-assembly.
So could anyone here re-write me that code ?
Bonita Montero
2020-05-13 18:57:18 UTC
Permalink
I simply compiled the C++-code to asm,
modified it and got what I wanted.

Loading...