;+
; Project     :	SOLAR-B - EIS
;
; Name        :	EIS_CPT_UINTTOBYTES
;
; Purpose     :	Converts UINT array to big endian BYTE array.
;
; Explanation :	Arranges BYTE data values MSByte first.
;               If fails then sets error.
;
; Use         :	< byte_array = eis_cpt_uinttobytes(unit_array) >
;
; Inputs      :	uint_array : UINTARR[n] uint values.
;
; Opt. Inputs : None.
;
; Outputs     : byte_array : BYTARR[2n] byte values.
;
; Opt. Outputs:	None.
;
; Keywords    : None.
;
; Calls       : None.
;
; Common      :	None.
;
; Restrictions:	None.
;
; Side effects:	Loses any extra dimensions of input array.
;
; Category    :	EIS_CPT.
;
; Prev. Hist. :	None.
;
; Written     :	Martin Carter RAL 18/10/04
;
; Modified    :	Version 0.0, 18/10/04, MKC
;
; Version     :	0.0, 18/10/04
;-
;**********************************************************

FUNCTION eis_cpt_uinttobytes, uint_array

  ; ensure uint

  uint_array = UINT(uint_array)

  ; get size of input

  nuint = N_ELEMENTS(uint_array)

  ; form byte array

  byte_array = BYTARR(2,nuint)

  byte_array[0,*] = ISHFT(uint_array,-8)

  byte_array[1,*] = uint_array

  ; this cannot be tested on big endian machine

  ;byte_array = BYTE(uint_array,0,2*nuint)

  ;BYTEORDER, byte_array, /SWAP_IF_LITTLE_ENDIAN

  ; return array

  RETURN, REFORM(byte_array,2*nuint)

END





