asm

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Experimenter
Learning poster
Posts: 76
Joined: Thu Mar 13, 2003 5:12 am
Location: Russia

asm

Post by Experimenter » Tue Jun 10, 2003 11:30 am

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]

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev » Thu Jun 12, 2003 12:08 pm

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"
        ...

Experimenter
Learning poster
Posts: 76
Joined: Thu Mar 13, 2003 5:12 am
Location: Russia

Post by Experimenter » Thu Jun 12, 2003 12:10 pm

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.

Post Reply

Return to “C++”