bool32 rnd
frac32 base
frac32 diffchance
int32 count
int32 index
frac32.u.map length
frac32.u.map base
frac32.u.map diffchance
frac32.u.map differents
frac32.u.map diffsize
bool32.tgl nonseed
spinner max
static const uint32_t LENGTHPOW = (6);
static const uint32_t LENGTH = (1 << 6);
static const uint32_t LENGTHMASK = ((1 << 6) - 1);
static const uint32_t BITS = 8;
static const uint32_t GAIN = 20;
int sz = attr_max + 1;
uint8_t *a1, *a2;
uint16_t *a3;
int val, i, pos, prv;
bool rnd;
static uint8_t _a1[LENGTH] __attribute__((section(".sdram")));
a1 = &_a1[0];
static uint8_t _a2[LENGTH] __attribute__((section(".sdram")));
a2 = &_a2[0];
static uint16_t _a3[LENGTH] __attribute__((section(".sdram")));
a3 = &_a3[0];
{
int i;
for (i = 0; i < LENGTH; i++) {
a1[i] = (uint8_t)GenerateRandomNumber();
a2[i] = (uint8_t)GenerateRandomNumber();
a3[i] = (uint16_t)GenerateRandomNumber();
}
}
if ((inlet_rnd > 0) && !rnd) {
rnd = 1;
for (i = 0; i < LENGTH; i++) {
a1[i] = (uint8_t)GenerateRandomNumber();
a2[i] = (uint8_t)GenerateRandomNumber();
a3[i] = (uint16_t)GenerateRandomNumber();
}
} else if (inlet_rnd < 1) {
rnd = 0;
}
if (!(inlet_count == prv)) {
int length = param_length >> 21;
length = length > 0 ? length : 1;
int cnt = inlet_count;
cnt = cnt - cnt / length * length;
cnt += cnt < 0 ? length : 0;
cnt = cnt & 63;
int base = ___SMMUL(__USAT(param_base + inlet_base, 27) << 4, sz - 1 << 1);
val = base;
if ((param_nonseed < 1 ? a2[cnt] : (uint8_t)(GenerateRandomNumber())) <
(__USAT(param_diffchance + inlet_diffchance, 27) >> 19)) {
val += ___SMMUL(___SMMUL((int32_t)a3[___SMMUL(
(param_nonseed < 1
? a1[cnt]
: (uint8_t)(GenerateRandomNumber()) << 1),
param_differents << 2)]
<< 13,
param_diffsize)
<< 5,
sz << 2) +
1;
}
val = val - val / sz * sz;
val += (val < 0 ? sz : 0);
}
outlet_index = val;
prv = inlet_count;