Afternoon, bitRake.

shr eax, 16
isn't it?:grin:

Cheers,
Scronty
Posted on 2002-05-09 18:11:47 by Scronty
Scronty, yes. Thanks, I was a little quick on my responses.
Posted on 2002-05-10 07:13:35 by bitRAKE
Could the following code be smaller and faster?
Thanks.



GetLuminosity proc color:COLORREF ; the algorithm is (((rgbMax+rgbMin) * HLSMAX) + RGBMAX ) / (2*RGBMAX);
HLSMAX equ 240
RGBMAX equ 255
mov edx, GetGValue(color)
mov ecx, GetBValue(color)
mov eax, GetRValue(color)
max eax, <ecx, edx> ; the maximum value is returned to eax
min ecx, <eax, edx> ; the minimum value is returned to ecx
add eax, ecx ; rgbmax + rgbmin
mov ecx, HLSMAX
mul ecx
add eax, RGBMAX ; we ignore the edx part since the the result is within 32 bits
shr eax, 1
xor edx,edx
mov cx, RGBMAX
div cx
ret
GetLuminosity endp
Posted on 2002-05-10 10:11:45 by yoursguideline