Dvb-t inner interleaver

hi everybody,
so far I’m working upon a GNURadio implementation of one of the
functional
block of the DVB-t standard, the “Inner interleaver”,

my trouble in this moment is that such functional block needs to perform
a
permutation on a 1512-bits length chunk:

i’ve tried to modify the step of this loop, this way:

STEP=1512;

for (int i= 0, i<= noutput_items, i+=STEP)

for (int w= 0, w<= 1511, w+=1) out[i+w]=…

but this doesn’t seem to work properly. ( I guess because I’m trying to
reference items too far away from my current position in the stream).

another thing i’ve tried is:

for (int i= 0, i<= noutput_items, i+=1)

for (int w= 0, w<= 1511, w+=1) out[1512*i+w]=…

but this even segfaults at runtine.

which is the wise way I should do interleaving on such big chunks in
GNURadio?

thank you guys,
and best regards