Prilog
Funkcija za računanje koeficijenata delta i fact.
void calcDelta (Uint16 length, Uint16 *delta, Uint16 *fact) {
volatile Uint16 tmp, max=0;
volatile Uint16 n=0;
// odredi najveci stepen (2^max)=max_integer
tmp=0xFFFF; // ovo je najveci Uint16 broj
while (tmp>0) {
max++;
tmp = tmp >> 1;
}
// odredi stpen n (2^n)=delta
tmp=length;
while (tmp>0) {
n++;
tmp = tmp >> 1;
}
n = max - n + 1;
*delta = (Uint16)pow((double)2,(double)n);
*fact = n;
}