Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change
Quote from: zedd151 on Today at 07:11:04 AMFor a bit of levity here, in the days of old... in any country (or empire) the standard foot was defined as the size of the emporers (or king, etc) actual foot length. Leading to incompatibility issues between nations.There is small emperors ,Napoleon was short,while a Danish king around 1900 was over 2 metres tall
;;
SIMD_BinaryScan
This function performs a binary search for a chunk of data (pSearchPattern) within a larger dataset (pDataBuffer).
It uses SSE2 instructions for optimization and speed, especially with large datasets.
The function can be used to find data of any size, including strings (case-sensitive) within a larger text.
Parameters:
pDataBuffer (in): Pointer to the start of the larger dataset in which the search is performed.
This is the buffer in which you are searching.
DataSize (in): The size (in bytes) of the dataset. The size must be greater than or equal to 16 bytes.
pSearchPattern (in): Pointer to the start of the search pattern (the data chunk to search for within the dataset).
This is the smaller data chunk you are searching for.
PatternSize (in): The size (in bytes) of the search pattern.
Return Value:
Success: If the pattern is found, the function returns a pointer to the starting position of the matching chunk in the dataset.
Failure: Returns 0 (&NULL) if the pattern is not found in the dataset.
;;
;;
CompareSmallDataBlock
This function performs a byte-by-byte comparison of a small dataset (<= 16 bytes) with a search pattern.
It is used as a fallback when the dataset is too small for SIMD optimizations.
Parameters:
pDataBuffer (in): Pointer to the start of the dataset.
DataSize (in): The size (in bytes) of the dataset.
pSearchPattern (in): Pointer to the start of the search pattern.
PatternSize (in): The size (in bytes) of the search pattern.
Return Value:
Success: If the pattern is found, the function returns a pointer to the starting position of the match.
Failure: Returns 0 (&NULL) if the pattern is not found.
;;
;;
VerifyPatternMatch
This function performs a detailed comparison of a search pattern with a dataset block.
It is used after a potential match is found in the main function to confirm the match.
Parameters:
pDataBuffer (in): Pointer to the start of the dataset block.
pSearchPattern (in): Pointer to the start of the search pattern.
PatternSize (in): The size (in bytes) of the search pattern.
Return Value:
Success: If the pattern matches, the function returns a pointer to the starting position of the match.
Failure: Returns 0 (&NULL) if the pattern does not match.
;;
; Define data and code sections
.data
; Define example data
haystack db "This is a simple string to search within. While trying to find sinp from sinples string", 0
needle db "search wi", 0
; Variables to store string lengths
haystack_len dd ?
needle_len dd ?
; Variable to store the search result
result dd ?
.code
start:
; Calculate the length of the haystack string
invoke lstrlen, addr haystack
mov haystack_len, eax
; Calculate the length of the needle string
invoke lstrlen, addr needle
mov needle_len, eax
; Call the SIMD_BinaryScan function
invoke SIMD_BinaryScan, addr haystack, haystack_len, addr needle, needle_len
mov result, eax
; Check the result
.if result == 0
; If the result is 0, the pattern was not found.
print "Pattern not found.", 13, 10
.else
; If the result is non-zero, the pattern was found.
print "Pattern found at position: "
print str$(result), 13, 10
.endif
; Terminate the program
invoke ExitProcess, 0
Quote from: guga on Today at 10:50:09 AMtks, but the result is empty. I guess you forgot to paste the result on the text file.And I forgot to test the zip file. That was indeed my fault, sorry.