Assumed, you can implement two functions:
typedef enum {
e3DRowData,
e3DColData,
e3DStkData
} eDataOrientation;
BOOL Get1D_Dump(BYTE* pcDataDump, UINT& uiDataLen,
int iXPos);
BOOL Get3D_Dump(BYTE* pcDataDump, UINT& uiDataLen,
int iXPos, int iYPos, int iZPos, eDataOrientation);
...and the function:
int TryToFind(BYTE* pbyWhere, BYTE* pbyWhat,
UINT uiWhereLen, UINT uiWhatLen,
size_t sizeBytesPerElement)
{
BYTE* pbyPos = pbyWhere;
while (pbyPos &&
uiWhereLen > (pbyPos - pbyWhere)) {
pbyPos = (BYTE*) memchr(pbyPos, pbyWhat[0],
uiWhereLen - (pbyPos - pbyWhere));
if (pbyPos) {
UINT uiRest = pbyPos % sizeBytesPerElement;
if (uiRest) {
pbyPos += (sizeBytesPerElement - uiRest);
countinue;
}
if (0 == memcmp(pbyPos, pbyWhat, uiWhatLen)) {
return int((pbyPos - pbyWhere) / sizeBytesPerElement);
}
pbyPos += sizeBytesPerElement;
}
}
return (-1);
}
...then you could write :) :
...
...
BYTE* pc1DData = NULL;
UINT ui1DDataLen = 0;
BYTE* pc3DData = NULL;
UINT ui3DDataLen = 0;
if (Get1D_Dump(pc1DData, ui1DDataLen,
0 ) &&
Get3D_Dump(pc3DData, ui3DDataLen,
0 ,
0 ,
0 ,
e3DStkData )) {
int iFoundPos = TryToFind(pc3DData, pc1DData,
ui3DDataLen, ui1DDataLen,
sizeof(double) );
if (-1 != iFoundPos) {
}
}