I want to optimize a process in a realtime thread. 
The process takes a pointer to a memory block of variable length. (between 1 and 64k)
This memory block is filled with 32bit floats (between 0 and 1)
Every float has to be multiplied by a constant value -> [2^x], where x >0 and x<32)
Somebody any idea what could be the fastest routine?
Now I do it in a for next loop with peek and poke, but there must be a faster way in fasm...(storing the constant in a register first...)
Anybody knows how (perhaps by using some SSE registers?)
(i am a asm newbie)
			
			
									
									
						Memory block calculations : optimize?
Maybe you can just add the number 'x' to the exponent part of the float?
This might look something like this(?):
I havent tested the code so i can't tell if it'll work or if it'll be faster than using the FPU after all. I'm not familiar with SSE op:s so maybe there's some op there that does it all in one go?
			
			
									
									
						This might look something like this(?):
Code: Select all
 ...
mov edx, x
 ...
mov eax, dword [ebp] ; ebp holds address to data
mov ebx, eax
shr eax, 23
add al, dl
and ebx, %10000000 01111111 11111111 11111111
shl eax, 23
or ebx, eax
mov dword [ebp], ebx
 ...
