In Delphi 7 such a trick is possible with the calculation of the jump address in the case statement. For example, there is case statement by prefix = 0,1,2,3 when LZ decompressing (but it breaks optimization):
Code:
var
cm0: array[0..3] of dword;
...
asm
mov dword [cm0],offset m0
mov dword [cm0+4],offset m1
mov dword [cm0+8],offset m2
mov dword [cm0+12],offset m3
end;
<Decompressing loop starts>
asm
mov eax,prefix
jmp offset cm0+eax*4
end;
m0: offs:=...; goto 1000;
m1: offs:=...; goto 1000;
m2: offs:=...; goto 1000;
m3: offs:=...;
1000:
Is it possible in C to calculate the addresses of the labels and make such a jump? Or does the translator do it itself?