implemented math callbacks in TKCh generation => made code easier
part 3/3 (done lol)
This commit is contained in:
parent
6a821910f3
commit
340834adf6
@ -263,6 +263,7 @@ void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize)
|
|||||||
{
|
{
|
||||||
int numberBuffer;
|
int numberBuffer;
|
||||||
int numberBuffer2;
|
int numberBuffer2;
|
||||||
|
double (*cb)(int, int);
|
||||||
|
|
||||||
for (int i = 0; i < textKeyChainSize; i++)
|
for (int i = 0; i < textKeyChainSize; i++)
|
||||||
{
|
{
|
||||||
@ -279,16 +280,18 @@ void generateTextKeyChain(char *key, int *textKeyChain, int textKeyChainSize)
|
|||||||
//FILL textKeyChain
|
//FILL textKeyChain
|
||||||
if ((numberBuffer + 1) % 3 == 0)
|
if ((numberBuffer + 1) % 3 == 0)
|
||||||
{
|
{
|
||||||
textKeyChain[textKeyChainSize - (i + 1)] = key[numberBuffer] * key[numberBuffer2];
|
cb = multiply_cb;
|
||||||
}
|
}
|
||||||
else if ((numberBuffer + 1) % 2 == 0)
|
else if ((numberBuffer + 1) % 2 == 0)
|
||||||
{
|
{
|
||||||
textKeyChain[textKeyChainSize - (i + 1)] = key[numberBuffer] - key[numberBuffer2];
|
cb = subtract_cb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textKeyChain[textKeyChainSize - (i + 1)] = key[numberBuffer] + key[numberBuffer2];
|
cb = sum_cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textKeyChain[textKeyChainSize - (i + 1)] = doMathematicalOperation(key[numberBuffer], key[numberBuffer2], cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user