Mercurial > projects > ldc
comparison tests/mini/naked_asm5.d @ 1448:e92e14690a4f
change mingw32 versioning to version(Windows)
author | Kelly Wilson <wilsonk cpsc.ucalgary.ca> |
---|---|
date | Sun, 31 May 2009 11:20:26 -0600 |
parents | a400b1dd657f |
children |
comparison
equal
deleted
inserted
replaced
1447:a400b1dd657f | 1448:e92e14690a4f |
---|---|
1 int foo(int op)(int a, int b) | 1 int foo(int op)(int a, int b) |
2 { | 2 { |
3 version(X86) | 3 version(X86) |
4 { | 4 { |
5 const OP = (op == '+') ? "add" : "sub"; | 5 const OP = (op == '+') ? "add" : "sub"; |
6 version (mingw32) | 6 version (Windows) |
7 { | 7 { |
8 asm { naked; } | 8 asm { naked; } |
9 mixin("asm{push EBP;mov EBP,ESP;sub ESP,8;mov ECX,[EBP+8];"~OP~" EAX, ECX;add ESP,8;pop EBP;}"); | 9 mixin("asm{push EBP;mov EBP,ESP;sub ESP,8;mov ECX,[EBP+8];"~OP~" EAX, ECX;add ESP,8;pop EBP;}"); |
10 asm { ret; } | 10 asm { ret; } |
11 } else | 11 } else |