Changeset b0aba4c4 in rtems


Ignore:
Timestamp:
Apr 27, 1998, 4:10:16 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
0c508af
Parents:
eac9871
Message:

Added swap of unsigned16

Location:
c/src/exec/score/cpu
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/cpu/a29k/cpu.h

    reac9871 rb0aba4c4  
    962962 
    963963#define CPU_swap_u32( value ) \
    964   ((value&0xff) << 24) | (((value >> 8)&0xff) << 16) | (((value >> 16)&0xff) << 8) | ((value>>24)&0xff)
     964  ((value&0xff) << 24) | (((value >> 8)&0xff) << 16) | \
     965    (((value >> 16)&0xff) << 8) | ((value>>24)&0xff)
     966
     967#define CPU_swap_u16( value ) \
     968  (((value&0xff) << 8) | ((value >> 8)&0xff))
    965969
    966970#ifdef __cplusplus
  • c/src/exec/score/cpu/hppa1.1/cpu.h

    reac9871 rb0aba4c4  
    600600}
    601601
     602#define CPU_swap_u16( value ) \
     603  (((value&0xff) << 8) | ((value >> 8)&0xff))
     604
    602605#endif   /* ! ASM */
    603606
  • c/src/exec/score/cpu/i386/i386.h

    reac9871 rb0aba4c4  
    166166)
    167167{
     168  unsigned long lout;
     169
    168170  asm volatile( "rorw  $8,%%ax;"
    169171                "rorl  $16,%0;"
    170                 "rorw  $8,%%ax" : "=a" (value) : "0" (value) );
    171   return( value );
     172                "rorw  $8,%%ax" : "=a" (lout) : "0" (value) );
     173/* this should be better for i486dx and above */
     174/*
     175    __asm__ volatile( "bswap %0" : "=r"  (lout) : "0"   (lin));
     176*/
     177  return( lout );
     178}
     179
     180static inline unsigned int i386_swap_U16(
     181  unsigned int value
     182)
     183{
     184    unsigned short      sout;
     185
     186    __asm__ volatile( "rorw $8,%0" : "=r"  (sout) : "0"   (value));
     187    return (sout);
    172188}
    173189
     
    440456 
    441457#define CPU_swap_u32( _value )  i386_swap_U32( _value )
     458#define CPU_swap_u16( _value )  i386_swap_U16( _value )
    442459 
    443460/* i80x86 I/O instructions */
  • c/src/exec/score/cpu/i960/i960.h

    reac9871 rb0aba4c4  
    256256}
    257257
     258#define CPU_swap_u16( value ) \
     259  (((value&0xff) << 8) | ((value >> 8)&0xff))
     260
    258261#ifdef __cplusplus
    259262}
  • c/src/exec/score/cpu/m68k/m68k.h

    reac9871 rb0aba4c4  
    244244}
    245245
     246static inline unsigned int m68k_swap_u16(
     247  unsigned int value
     248)
     249{
     250  unsigned short swapped = value;
     251
     252  asm volatile( "rorw  #8,%0" : "=d" (swapped) : "0" (swapped) );
     253
     254  return( swapped );
     255}
     256
    246257/* XXX this is only valid for some m68k family members and should be fixed */
    247258
     
    253264
    254265#define CPU_swap_u32( value )  m68k_swap_u32( value )
     266#define CPU_swap_u16( value )  m68k_swap_u16( value )
    255267
    256268#endif  /* !ASM */
  • c/src/exec/score/cpu/mips64orion/cpu.h

    reac9871 rb0aba4c4  
    942942}
    943943
     944#define CPU_swap_u16( value ) \
     945  (((value&0xff) << 8) | ((value >> 8)&0xff))
     946
    944947/*
    945948 *  Miscellaneous prototypes
  • c/src/exec/score/cpu/no_cpu/cpu.h

    reac9871 rb0aba4c4  
    860860}
    861861
     862#define CPU_swap_u16( value ) \
     863  (((value&0xff) << 8) | ((value >> 8)&0xff))
     864
    862865#ifdef __cplusplus
    863866}
  • c/src/exec/score/cpu/powerpc/cpu.h

    reac9871 rb0aba4c4  
    10921092}
    10931093
     1094#define CPU_swap_u16( value ) \
     1095  (((value&0xff) << 8) | ((value >> 8)&0xff))
     1096
    10941097#ifdef __cplusplus
    10951098}
  • c/src/exec/score/cpu/sh/sh.h

    reac9871 rb0aba4c4  
    135135}
    136136
     137static inline unsigned int sh_swap_u32(
     138  unsigned int value
     139)
     140{
     141  register unsigned int swapped ;
     142
     143  asm volatile ( "swap.b %1,%0 : "=r" (swapped) : "r"  (value) );
     144
     145  return( swapped );
     146}
     147
    137148#define CPU_swap_u32( value ) sh_swap_u32( value )
     149#define CPU_swap_u16( value ) sh_swap_u16( value )
    138150
    139151/*
  • c/src/exec/score/cpu/sparc/cpu.h

    reac9871 rb0aba4c4  
    995995}
    996996
     997#define CPU_swap_u16( value ) \
     998  (((value&0xff) << 8) | ((value >> 8)&0xff))
     999
    9971000#endif ASM
    9981001
  • c/src/exec/score/cpu/unix/cpu.h

    reac9871 rb0aba4c4  
    992992}
    993993
     994#define CPU_swap_u16( value ) \
     995  (((value&0xff) << 8) | ((value >> 8)&0xff))
     996
    994997/*
    995998 *  Special Purpose Routines to hide the use of UNIX system calls.
Note: See TracChangeset for help on using the changeset viewer.