MCPcopy Create free account
hub / github.com/DentonW/DevIL / iMemSwap

Function iMemSwap

DevIL/src-IL/src/il_utility.cpp:148–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148ILAPI void ILAPIENTRY iMemSwap(ILubyte *s1, ILubyte *s2, const ILuint size)
149{
150 const ILuint block_size = 4096;
151 const ILuint blocks = size/block_size;
152 ILuint i;
153
154 ILubyte *block = (ILubyte*)ialloc(block_size);
155 if(block == NULL) return;
156 for( i = 0; i < blocks; i++ ) {
157 memcpy(block,s1,block_size);
158 memcpy(s1,s2,block_size);
159 memcpy(s2,block,block_size);
160 s2 += block_size;
161 s1 += block_size;
162 }
163 i = size - i*block_size;
164 if( i > 0 ) {
165 memcpy(block,s1,i);
166 memcpy(s1,s2,i);
167 memcpy(s2,block,i);
168 }
169 ifree(block);
170 return;
171}

Callers 1

ILAPIENTRY iFlipBufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected