Download Pelles C here: http://www.smorgasbordet.com/pellesc/

#ifdef _PELLESC__
#define MD_ASSERT(cond) do {} while(0)
#define MD_UNREACHABLE() do {} while(0)
#elif at the beginning of the block there.#include <stdlib.h>
#include <stdint.h>
// All Railgun variants are written by Georgi 'Kaze', they are free, however I expect the user to mention its homepage, that is: http://www.sanmayce.com/Railgun/index.html
// Author's email: sanmayce@sanmayce.com
// Caution: For better speed the case 'if (cbPattern==1)' was removed, so Pattern must be longer than 1 char.
char * Railgun_Doublet (char * pbTarget, char * pbPattern, uint32_t cbTarget, uint32_t cbPattern)
{
char * pbTargetMax = pbTarget + cbTarget;
register uint32_t ulHashPattern;
uint32_t ulHashTarget, count, countSTATIC;
if (cbPattern > cbTarget) return(NULL);
countSTATIC = cbPattern-2;
pbTarget = pbTarget+cbPattern;
ulHashPattern = (*(uint16_t *)(pbPattern));
for ( ;; ) {
if ( ulHashPattern == (*(uint16_t *)(pbTarget-cbPattern)) ) {
count = countSTATIC;
while ( count && *(char *)(pbPattern+2+(countSTATIC-count)) == *(char *)(pbTarget-cbPattern+2+(countSTATIC-count)) ) {
count--;
}
if ( count == 0 ) return((pbTarget-cbPattern));
}
pbTarget++;
if (pbTarget > pbTargetMax) return(NULL);
}
}
QuotePelles C IDE -> File -> New -> Resources -> right click untitled -> New -> Dialog
Page created in 0.063 seconds with 15 queries.