I was thinking of considering two uint types as a ulon type
Ok, this will also replace two uint values, which may not be desirable ...
You can try some C # code in unsafe mode, which can really work quite well. How:
public static unsafe void SwapInts(uint[] data) {
int cnt = data.Length;
fixed (uint* d = data) {
byte* p = (byte*)d;
while (cnt-- > 0) {
byte a = *p;
p++;
byte b = *p;
*p = *(p + 1);
p++;
*p = b;
p++;
*(p - 3) = *p;
*p = a;
p++;
}
}
}
On my computer, the throughput is about 2 GB per second.
Guffa source
share