view tests/mini/naked_asm1.d @ 1135:8ebbad15fc99

Remove struct padding which was making this test fail on 64-bit systems.
author Frits van Bommel <fvbommel wxs.nl>
date Tue, 24 Mar 2009 03:14:22 +0100
parents 4c524d80e6e1
children
line wrap: on
line source

extern(C) int printf(char*, ...);

void main()
{
    int i = func();
    printf("%d\n", i);
    assert(i == 42);
}

int func()
{
    version (D_InlineAsm_X86)
    {
        asm
        {
            naked;
            mov EAX, 42;
            ret;
        }
    }
    else version(D_InlineAsm_X86_64)
    {
        asm
        {
            naked;
            movq RAX, 42;
            ret;
        }
    }
}