Re: Array Byte swapping with SSE
Re: Array Byte swapping with SSE
- Subject: Re: Array Byte swapping with SSE
- From: Eric Albert <email@hidden>
- Date: Thu, 27 Jul 2006 11:24:15 -0700
On Jul 27, 2006, at 11:15 AM, Jeremy Sagan wrote:
Does anyone have any example code for endian byte swapping an
aligned array of SInt16's using SSE on intel Macs?
I think is should be the equivalent of a sequence of loads,
permutes, and stores but I am not sure where to find the C
interface documentation for SSE and I am very interested to see
sample code like this.
Unless your array is huge, you'll usually get reasonable performance
from a simple for loop:
#include <libkern/OSByteOrder.h>
for(int i = 0; i < length; i++) {
array[i] = OSSwapInt16(array[i]);
}
That's the main reason why we haven't added bulk byte swappers to the
system yet. We've found that byte swapping rarely shows up as a
performance bottleneck for us.
If it is a performance bottleneck for you, you might want to ask
about this on the perfoptimization-dev mailing list.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden