-
float routines
ok i have made a routine for finding floats in an array of bytes. However the routine finds floats where it is not supposed to, and i cant understand for the live life of me why :(
Code:
float *ptr = NULL;
for(int buffypart = 0; buffypart < READSPURT; ++buffypart)
{
ptr = (float*)&bytebuffy[buffypart];
if(*ptr == searchnum)
{
g_FoundCount++;
Addresses1[g_FoundCount] = readbase + buffypart;
}
}
ok and g_FoundCount is added too many times i am sure. Why :)
-
Try this.
Code:
float *ptr = NULL;
for(int buffypart = 0; buffypart < READSPURT;)
{
ptr = (float*)&bytebuffy[buffypart];
if(*ptr == searchnum)
{
g_FoundCount++;
Addresses1[g_FoundCount] = readbase + buffypart;
buffypart += sizeof(float);
}
else
++buffypart;
}