Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array Byte swapping with SSE



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:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden
References: 
 >Array Byte swapping with SSE (From: Jeremy Sagan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.