arrow_back_ios Back to List

Caching Pointer Arguments

Offload KB - case-studies

Old Content Alert

Please note that this is a old document archive and the will most likely be out-dated or superseded by various other products and is purely here for historical purposes.

Pointer arguments can be similarly cached. In the next example we assume that the first pointer parameter is dereferenced frequently inside func or functions it calls. Hence we could cache only the first argument (subject to the same issues described in the previous articles /kb/135.html).

	auto localptr = *ptrarg1; //DMA or SW cache read into a local
	ptr->func(&localptr,ptrarg2);//outer this pointer and local first argument
	*ptrarg1 = localptr; //writing data back

Note that this example could also use cache classes described in /kb/136.html.