I wanna scale a number down to a limited value but since shr doesn't do this with operands i find myself using this method
It returns the shift amount to scale down a new value relative to the original value using shr operand

FindShiftValue proc Value:DWORD,Max:DWORD

xor eax,eax
mov ecx,value
.if ecx>Max
shr ecx,1
inc eax
jmp @b

FindShiftValue endp

But having got the result it means I have to got through the same method in reverse to scale an amount down! This seems horrendously slow to me.
I think I'm being incredibly silly here. Can anyone please point me in faster direction....
Posted on 2006-09-10 11:40:17 by Nice Eddie
DOH!! RTMF eh  :oops:

D3 /5 SHR r/m16,CL Unsigned divide r/m16 by 2, CL times

ignore - mod please delete
Posted on 2006-09-10 13:59:34 by Nice Eddie

ignore - mod please delete

I don't see any difference between how questions are solved (by yourself or someone else), as both should be made available to the public for search purposes... someone else may just come across the same problem ;)
Posted on 2006-09-10 22:27:56 by SpooK
Yeah I agree, I've often found myself answering my own questions in public forums.. the post stays put.. more generally,it seems that the best way to solve any problem is to define it, and failing that, to redefine it :)
Posted on 2006-09-10 23:06:37 by Homer
Curse my effective writing style!  :lol:

I supose you're right, im just feeling a little stupid since Ive lost count of the number of times ive screamed at (real world) friends  'Read The Flipping Manual'  :P

Good job none of them visit here or id be getting grilled about now. ;)
Posted on 2006-09-11 00:54:27 by Nice Eddie
RTFM usually helps, but sometimes it works against you when you are already too focused on a problem. The best thing to do is walk away and come back to it later, RTFM first and then work from there :)
Posted on 2006-09-11 02:00:27 by SpooK