Cube  tools.mm at [4b002822f9]

File src/tools.mm artifact 22d3464477 part of check-in 4b002822f9


// implementation of generic tools

#include "tools.h"
#include <new>

///////////////////////// misc tools ///////////////////////

void
endianswap(
    void *memory, int stride, int length) // little indians as storage format
{
	if (*((char *)&stride))
		return;
	loop(w, length) loop(i, stride / 2)
	{
		uchar *p = (uchar *)memory + w * stride;
		uchar t = p[i];
		p[i] = p[stride - i - 1];
		p[stride - i - 1] = t;
	}
}