Page 1 of 1

asm

Posted: Tue Jun 10, 2003 11:30 am
by Experimenter
I was just thinking if it is possible to use assembly in c++ code I am sending to judge.
for example will this code be OK:
[cpp]
int a = 0xf;
asm{

add a,0xf;
}

[/cpp]

Posted: Thu Jun 12, 2003 12:08 pm
by Ivan Golubev
It's possible to use assembly but it must be in GAS format, i.e. something like this:

Code: Select all

 __asm__ __volatile__ (
        "pushal\n"
        "movl   $tbl, %ebx\n"
        "movl   %ebx, %edx\n"
        "xorl   %eax, %eax\n"
        ".align 16\n"
"__0:\n"
        "movl   %eax, (%edx)\n"
        "addl   $4, %edx\n"
        "addl   $34943, %eax\n"
        ...

Posted: Thu Jun 12, 2003 12:10 pm
by Experimenter
Ivan Golubev wrote:It's possible to use assembly but it must be in GAS format, i.e. something like this:

Code: Select all

 __asm__ __volatile__ (
        "pushal\n"
        "movl   $tbl, %ebx\n"
        "movl   %ebx, %edx\n"
        "xorl   %eax, %eax\n"
        ".align 16\n"
"__0:\n"
        "movl   %eax, (%edx)\n"
        "addl   $4, %edx\n"
        "addl   $34943, %eax\n"
        ...
hm. thanks. thanks a lot indeed.