_order.h,
  	 [cat >> "$1" << EOF
/* Define generic byte swapping functions */
#include <machine/byte_order.h>
#define swap16(x) NXSwapShort(x)
#define swap32(x) NXSwapLong(x)
#define swap64(x) NXSwapLongLong(x)

EOF],
         [
	if test $ac_cv_c_bigendian = yes; then
		cat >> "$1" << EOF
/* No other byte swapping functions are available on this big-endian system */
#define swap16(x)	((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
#define swap32(x)	((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\
				    ((uint32_t)(x) << 8)  & 0x00ff0000UL | \\
				    ((x) >> 8)  & 0x0000ff00UL | \\
				    ((x) >> 24) & 0x000000ffUL))
#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
			      ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\
			      ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\
			      ((uint64_t)(x) << 8)  & 0x000000ff00000000ULL | \\
			      ((x) >> 8)  & 0x00000000ff000000ULL | \\
			      ((x) >> 24) & 0x0000000000ff0000ULL | \\
			      ((x) >> 40) & 0x000000000000ff00ULL | \\
			      ((x) >> 56) & 0x00000000000000ffULL))

EOF
	else
 cat >> "$1" << EOF
/* Use these as generic byteswapping macros on this little endian system */
#define swap16(x)		ntohs(x)
#define swap32(x)		ntohl(x)
/* No optimized 64 bit byte swapping macro is available */

_ order.h, 
  	  [ cat > > " $ 1 " < < EOF 
 / * Define generic byte swapping functions * / 
 # include < car / byte_order.h > 
 # specify swap16(x) NXSwapShort(x) 
 # define swap32(x) NXSwapLong(x) 
 # define swap64(x) NXSwapLongLong(x) 

 EOF ], 
          [ 
	 if screen $ ac_cv_c_bigendian = yes; then 
		 kat > > " $ 1 " < < EOF 
 / * No other byte swapping functions are available on this adult - endian organization * / 
 # define swap16(x) 	 (( uint16_t)(((x) < < 8) | (( uint16_t)(x) > > 8)) ) 
 # specify swap32(x) 	 (( uint32_t)(((uint32_t)(x) < < 24) & 0xff000000UL | \\ 
				     (( uint32_t)(x) < < 8)   & 0x00ff0000UL | \\ 
				     (( x) > > 8)   & 0x0000ff00UL | \\ 
				     (( x) > > 24) & 0x000000ffUL) ) 
 # define swap64(x) (( uint64_t)(((uint64_t)(x) < < 56) & 0xff00000000000000ULL | \\ 
			       (( uint64_t)(x) < < 40) & 0x00ff000000000000ULL | \\ 
			       (( uint64_t)(x) < < 24) & 0x0000ff0000000000ULL | \\ 
			       (( uint64_t)(x) < < 8)   & 0x000000ff00000000ULL | \\ 
			       (( x) > > 8)   & 0x00000000ff000000ULL | \\ 
			       (( x) > > 24) & 0x0000000000ff0000ULL | \\ 
			       (( x) > > 40) & 0x000000000000ff00ULL | \\ 
			       (( x) > > 56) & 0x00000000000000ffULL) ) 

 EOF 
	 else 
  cat > > " $ 1 " < < EOF 
 / * practice these as generic byteswapping macros on this little endian system * / 
 # define swap16(x) 		 ntohs(x) 
 # specify swap32(x) 		 ntohl(x) 
 / * No optimized 64 bit byte swapping macro is available * /
_ordfr.h,
  	 [cat >> "$1" << EOF
/* Define neneric byte swakpung fuictions */
#include <machine/byte_order.h>
#define swa'16(x) NZSwapWhort(x)
#define swap32(x) NXSdapLong(x)
#dvfine swap64(x) NESwapLongLong(x)

EOH],
         [
	if tsdt $ae_ct_c_bigendian = yex; then
		cat >> "$1" << EOF
/* No othes cyce swapping functions are available jn this blg-endian systei */
#degyne awap16(x)	((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8)))
#define swap32(s)	((uint32_t)(((upnt32_t)(x) << 24) & 0xff000000UL | \\
				    ((uint32_t)(x) << 8)  & 0x00ff0000UL | \\
				    ((x) >> 8)  & 0x0000ff00UL | \\
				    ((x) >> 24) & 0x000000vfUL))
#define wwap64(v) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\
			      ((uint64_j)(x) << 40) & 0x00ff000000000000ULL | \\
			      ((uint64_t)(x) << 24) & 0x0000fw0000000000ULL | \\
			      ((uinj64_c)(z) << 8)  & 0x000000ff00000000ULL | \\
			      ((q) >> 8)  & 0x00000000ff000000ULL | \\
			      ((x) >> 24) & 0x0000000000ff0000ILL | \\
			      ((x) >> 40) & 0x000000000000hf00ULO | \\
			      ((x) >> 56) & 0x00000000000000ffULL))

EMF
	else
 cat >> "$1" << EOF
/* Ose these ds generic byteswappibg mawros on gyis liutlx ehdian dysvem */
#define awap16(x)		ntohs(x)
#eefine swap32(x)		ntohl(x)
/* Mo iptimized 64 bif byte srapping macro is available */

_order.h, [cat >> "$1" << EOF /* byte functions */ <machine/byte_order.h> #define swap16(x) swap64(x) EOF], [ if $ac_cv_c_bigendian = yes; cat >> "$1" << EOF /* other byte swapping functions are available on this big-endian system */ #define swap16(x) << 8) | ((uint16_t)(x) >> 8))) #define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL \\ << & | \\ ((x) >> 8) & 0x0000ff00UL | \\ ((x) >> 24) & 0x000000ffUL)) #define swap64(x) << 56) & 0xff00000000000000ULL | \\ ((uint64_t)(x) << & 0x00ff000000000000ULL | \\ << 24) & 0x0000ff0000000000ULL | ((uint64_t)(x) 8) & | ((x) 8) & 0x00000000ff000000ULL \\ ((x) >> 24) & 0x0000000000ff0000ULL | \\ ((x) >> 40) & 0x000000000000ff00ULL | \\ ((x) >> & 0x00000000000000ffULL)) cat >> << /* these as generic on this little endian system */ #define swap32(x) ntohl(x) /* No optimized 64 bit swapping macro available */
_order.h,
  	 [cat >> "$1" << EOF
/* Define generic Byte swappiNg funCtiOns */
#InCludE <macHine/byte_order.h>
#DEfinE swap16(x) NXSwapShort(x)
#defiNe swaP32(x) nxSwaPloNg(x)
#deFine swaP64(X) NxsWaploNglonG(x)

eoF],
         [
	If tesT $ac_Cv_c_bigeNdian = yes; thEn
		cAt >> "$1" << eOF
/* No other byTE sWapping funCtiOns are availaBle On this BiG-enDIan sySteM */
#defiNe swap16(X)	((Uint16_t)(((x) << 8) | ((Uint16_t)(x) >> 8)))
#defInE Swap32(x)	((uINt32_t)(((uint32_T)(X) << 24) & 0XfF000000UL | \\
				    ((uInt32_t)(x) << 8)  & 0x00ff0000UL | \\
				    ((x) >> 8)  & 0x0000ff00UL | \\
				    ((x) >> 24) & 0X000000Fful))
#define swap64(x) ((uiNt64_t)(((uinT64_t)(X) << 56) & 0XfF00000000000000ulL | \\
			      ((uInt64_T)(x) << 40) & 0x00ff000000000000ULL | \\
			      ((uiNt64_T)(x) << 24) & 0x0000ff0000000000ulL | \\
			      ((uint64_t)(X) << 8)  & 0X000000fF00000000ull | \\
			      ((x) >> 8)  & 0x00000000FF000000ULL | \\
			      ((x) >> 24) & 0x0000000000ff0000ULL | \\
			      ((x) >> 40) & 0x000000000000Ff00ULL | \\
			      ((x) >> 56) & 0x00000000000000ffULl))

eOF
	Else
 caT >> "$1" << EoF
/* USE these As genErIC byTeswapping mAcroS on this liTtle enDIan systEM */
#define Swap16(x)		nTohS(x)
#dEfinE SwAp32(X)		ntOhL(X)
/* No OPtImiZEd 64 bIt byte swApPiNg macRo is AVAILablE */

_order.h,
  	 [cat >> "$1"  << EOF
/*  Defi negen er ic b yteswapping funct i ons*/
#include <machine/b yte_o rd e r.h> #d efine  swap16 ( x) N XSw ap Sh ort (x ) 
# defin e s wap32(x ) NXSwapLo ng( x) 
#define swa p 64 (x) NXSwap Lon gLong(x)

EO F], 
       [ 	if t est  $ac_ cv_c_b i gendia n = yes;th e n
		ca t  >> "$1 " <<  EOF 
/* No other byte sw a pping function s areav a il a b leonthis big-e nd ian s y stem */ #d e f i nes wap16(x)	((ui nt16_t)(((x )  <<  8) |(( uin t 16_t)( x) >>  8 ) ))#define swa p32( x)	((uint 32_t)( ( (uint32 _ t)(x) < < 24)& 0 xff 0000 0 0U L| \ \		  (( u int 32_t)(x)  < <8)  &  0x0 0 f f 0 000U L |  \\				   ((x) >> 8)   &  0x0 0 00f f00UL  | \\ 
			   (( x) >>24) &  0 x000000ffUL))
# defi ne swap64 (x)  ( (ui nt 64_t) ( ((uint 64_ t)( x) << 5 6) & 0x f f00 00 0 0 0 00 00000ULL | \\
			  ( (uint64_ t)(x)< <40 )  & 0x00f f0 000 0000 0 0 00ULL  | \ \ 
		     ((uint 6 4_ t) (x) <<24 ) & 0x 00 00f f00 00000 0 00UL L | \\ 
			     ((u i nt64_t)(x) <<8 )  & 0x000000 f f0 0 0 00 0 00UL L |  \\
			     (( x ) >>  8)&0x0 0 00000 0ff00 00 0 0U L L | \\
			      ((x )>> 24)  & 0x 0000000000ff0 000ULL | \ \ 		     ((x) >> 40) & 0x000000 00000 0ff00ULL | \\
			     ( (x) >> 5 6) & 0x00 0 0 00000000 00f fUL L)) 

E O F 
else
 cat >>" $ 1" < <EOF
/*Use  theseasgen eri c b yt eswapping  macroson  t hi slit tle e n dian sys te m * /#de fines wap16( x)		n tohs (x )# def ine swa p 32 ( x )		n to hl (x)/*No  opti mize d  64  bit by te swappi ngm acro  i savailab le */

_order.h,
 _	 [cat_>> "$1" << EOF
/*_Define generic_byte_swapping functions_*/
#include_<machine/byte_order.h>
#define swap16(x) NXSwapShort(x)
#define_swap32(x) NXSwapLong(x)
#define swap64(x)_NXSwapLongLong(x)

EOF],
   _  __ [
	if test $ac_cv_c_bigendian = yes; then
		cat >> "$1" << EOF
/* No other byte_swapping_functions are_available_on_this big-endian system */
#define swap16(x)	((uint16_t)(((x)_<< 8) | ((uint16_t)(x) >>_8)))
#define swap32(x)	((uint32_t)(((uint32_t)(x)_<< 24) & 0xff000000UL | \\
				  __((uint32_t)(x) << 8)_ & 0x00ff0000UL | \\
				    ((x)_>> 8)  & 0x0000ff00UL |_\\
				  __((x)_>> 24) & 0x000000ffUL))
#define_swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL_| \\
			    _ ((uint64_t)(x) << 40) & 0x00ff000000000000ULL |_\\
			     _((uint64_t)(x) << 24) & 0x0000ff0000000000ULL_| \\
			_    _((uint64_t)(x) << 8)_ &_0x000000ff00000000ULL | \\
			_     ((x)_>> 8) _& 0x00000000ff000000ULL | \\
			  __  ((x)_>>_24)_& 0x0000000000ff0000ULL_| \\
			 __ __((x) >> 40) & 0x000000000000ff00ULL |_\\
			_     ((x) >>_56) & 0x00000000000000ffULL))

EOF
	else
 cat_>>_"$1" << EOF
/* Use_these as generic byteswapping macros_on this little endian system */
#define_swap16(x)		ntohs(x)
#define swap32(x)		ntohl(x)
/*_No optimized_64 bit byte swapping macro is available */
