Skip to content

Instantly share code, notes, and snippets.

@PontiacGTX
Created June 23, 2019 19:54
Show Gist options
  • Save PontiacGTX/0f0897ac1eaf93cb04a5c1e3c205dc4b to your computer and use it in GitHub Desktop.
Save PontiacGTX/0f0897ac1eaf93cb04a5c1e3c205dc4b to your computer and use it in GitHub Desktop.
__kernel void Add(float limit,__global unsigned char* arr)
{
for(float i=0;i<limit;i++)
{
arr[(int)i]=(char)i;
}
}
void Find(__global const char** begin,unsigned long length, const char* val,int found)
{
unsigned long index = 0;
if(length>0)
{
while (begin[index] != begin[length])
{
if (begin[index] == val)
{
found = index;
break;
}
index++;
}
}
else
{
found=-1;
}
}
__kernel void CopyBytes(__global unsigned char const* fileBytes,unsigned long length,__global unsigned char** compressedBytes, __global unsigned long* arrayCountCompressedBytes)
{
int found=-1;
int size=0;
for(unsigned long i=0;i<length;i++)
{
if(i+1<length)
{
const char* str=fileBytes[i] + fileBytes[i+1];
Find(compressedBytes,size,str,found);
if(found==-1)
{
arrayCountCompressedBytes[i]=i;
compressedBytes[i]=str;
size=i;
}
found=-1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment