Created
September 17, 2013 04:21
-
-
Save zorgiepoo/6590044 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T, typename P> | |
void ZGSearchWithFunctionHelperDirect(T *searchValue, bool (*comparisonFunction)(ZGSearchData *, T *, T *), ZGSearchData * __unsafe_unretained searchData, ZGMemorySize dataIndex, ZGMemorySize dataSize, ZGMemorySize dataAlignment, ZGMemorySize endLimit, P pointerSize, NSMutableData * __unsafe_unretained resultSet, ZGMemoryAddress address, void *bytes) | |
{ | |
//dataIndex is 'position' in the data, endLimit is (region_size) - (datatype_size) | |
//dataAlignment is amount to advance dataIndex for each iteration | |
while (dataIndex <= endLimit) | |
{ | |
if (comparisonFunction(searchData, (T *)((int8_t *)bytes + dataIndex), searchValue)) | |
{ | |
P memoryAddress = (P)(address + dataIndex); | |
[resultSet appendBytes:&memoryAddress length:pointerSize]; | |
} | |
dataIndex += dataAlignment; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment