Inline assembler increment 64bit counter?

Moved self answer from the question to an answer.

Up vote 1 down vote favorite share g+ share fb share tw.

I'd like to increment the 64bit(long type in C++) counter in inline assembly atomically. I know how to do that on 32bit value(int): asm volatile("lock; incl %0" : "=m" (val) : "m"(val)); But I have no idea how to perform that on long value. C++ assembly 64bit inline-assembly link|improve this question edited Mar 13 at 12:09Bo Persson23.1k51545 asked Mar 13 at 1:30MiniKarol1978 81% accept rate.

Some have cmpxchg8b, but not all. – David Schwartz Mar 13 at 2:05 64-bit code on icore7-avx – MiniKarol Mar 13 at 2:10 Ok, know I see that there is only some problem related to overflow, cause I've got strange values only when I increment value -1. – MiniKarol Mar 13 at 2:24.

Moved self answer from the question to an answer It was quite easy, but I haven't been familiar with x86-64. Asm volatile("lock; incq %0" : "=m" (val) : "m"(val)).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions