wow i am surprised about all your postings trying to help me... there are so much postings, that i have to read them all carefully, trying to understand and think about..
btw, the buffer i am using is an 1D array... and yes i think i can save some bytes when changing the 2-loop part to 1-loop. (i just removed one For/Next loop (without removing the code inside this loop) and i still saved some bytes when compiled and crinkled. (31 bytes different in packed version!)
static long buffer[307200]; // 640*480
float t1,t2,t3;
For (x=639; x>0; --x)
{
t2 = x*0.017453292519943295f; // x*(2*#PI/360)
// t1 = Sin(t2);
// t3 = Cos(t2);
__asm __volatile__ ("fsincos" : "=t" (t3), "=u" (t1) : "0" (t2));
For (y=339; y>0; --y)
{
buffer[x+ ((y+70)*640) ]= RGB((t1*y+temp),(t3*y-temp),240);
}
}
This version is 31 bytes smaller (packed), just a fast dirty test:
float t1,t2,t3;
For (x=639; x>0; --x)
{
t2 = x*0.017453292519943295f; // x*(2*#PI/360)
// t1 = Sin(t2);
// t3 = Cos(t2);
__asm __volatile__ ("fsincos" : "=t" (t3), "=u" (t1) : "0" (t2));
// For (y=339; y>0; --y)
// {
buffer[x+ ((y+70)*640) ]= RGB((t1*y+temp),(t3*y-temp),240);
// }
}
Optimizing the 2loops to 1loop is one idea... another ideas are: Replacing mciSendString stuff with mciSendCommand and using structures to save possible some bytes. And to find an alternative for the temp = (temp+1)%1024 stuff, which could save bytes in packed version too.
At least i will try to get work my 1k in VisualStudio 2008... due fact of this, i have to change some parts of the code like the ASM line... afaik i have to change the ASM line (GCC compiler) to something like this:
__forceinline void mySinCos(const float x,float &sine,float &cosine)
{
__asm
{
fld x;
fsincos;
mov eax,[cosine];
fstp dword ptr [eax];
mov eax,[sine];
fstp dword ptr [eax];
}
}