function convertEndianness( dtype, x, toLittleEndian ) {
	var view;
	var out;
	var m;
	var i;
	if ( ( IS_LITTLE_ENDIAN && toLittleEndian ) || ( !IS_LITTLE_ENDIAN && !toLittleEndian ) ) {
		return x;
	}
	view = new DataView( x.buffer );
	out = zeros( x.length, dtype );
	m = METHOD_TABLE[ dtype ];
	for ( i = 0; i < x.length; i++ ) {
		out[ i ] = view[ m ]( i*bytesPerElement( dtype ) );
	}
	return out;
}
Converts the endianness of an array.

@private
@param {string} dtype - array data type
@param {Collection} x - array to convert
@param {boolean} toLittleEndian - boolean indicating whether to convert to little endian
@returns {Collection} converted array