FilterFactory - Function "val"

Back to function listing

Value of slider i, mapped onto the range a to b

Syntax

val(i,a,b)

Original Machine Code (in OPER resource) of Filter Factory 3.0 and 3.0.4 for Photoshop/Win32

59 pop ecx (param_b) .
5E pop esi (param_a) .
5B pop ebx (param_i) .
2B C0 sub eax,eax res = 0;
0B DB or ebx,ebx .
7C 18 jl +$18 (@@1) if (param_i < 0) goto @@1; // return 0
83 FB 07 cmp ebx,$07 (7) .
7F 13 jnle +$13 (@@1) if (param_i > 7) goto @@1; // return 0
8B 44 9F 64 mov eax,[edi+ebx*4+$64 (ctl)] res = ctl[param_i];
2B CE sub ecx,esi param_b -= param_a;
0F AF C1 imul eax,ecx res *= param_b;
B9 FF 00 00 00 mov ecx,$000000ff (255) param_b = 255;
99 cdq edx = signbit(eax);
F7 F9 idiv ecx res /= param_b;
03 C6 add eax,esi res += param_a; // res = ctl[param_i] * (param_b-param_a) / 255 + param_a
@@1: @@1:
50 push eax return res;