Replace Asm code

I am working on a 32-64 migration work. The Cpp project contain some inline assembly code which is not supported on 64 bit. Here is the Asm code:

"__asm push test" (test is an int value)

I am stuck on this from a long time. Can someone please help me replace this asm code by Cpp code? Any help will be appreciated.

Vivek Soni
closed account (S6k9GNh0)
Some context would be nice...
int* a = Begin_args;
int* b = End_args; (where Begin_args and End_args are int*)
while (b > a) {
int test = *(--b);
__asm push test
What comes after that? The "push" statement in assembly is normally used to put that value to the next function call. If you are trying to use "push", be aware that changing architectures can make your code go wierd, such as when the endianess changes (different order of pushing values), or (as in your case), the size of an int has changed, and now the function is recieving a different sized value to what it wants (e.g. 32bit rather than 16bit, or 16bit rather than 8bit, or something like that...). You should then specify the exact bit-width of "test" in your C++ code to be like int8_t, or something like that.

For your question about replacing this with C++ code, try something like a "va_list", because this appears to be a way of supplying a function with a variable amount of arguments.

Remember, I'm not an expert at this (I could be completely wrong), but from my knowledge of assembly and computer architecture in general this is what your problem appears to me to be.
Okay, thanks a ton. Let me try "va_list" if it works.
Topic archived. No new replies allowed.