Changeset f3ade6c in mainline for arch/mips/include/byteorder.h


Ignore:
Timestamp:
2005-09-11T15:13:53Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2b3e0738
Parents:
61a9bbe
Message:

Avoid code duplication by creating generic byteorder.h.
Some naming changes in swap functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/mips/include/byteorder.h

    r61a9bbe rf3ade6c  
    3030#define __mips_BYTEORDER_H__
    3131
     32#include <arch/types.h>
     33#include <byteorder.h>
     34
    3235#ifdef BIG_ENDIAN
    33 static inline __u64 u64_le2host(__u64 n)
     36static inline __u64 __u64_le2host(__u64 n)
    3437{
    35         return ((n & 0xff) << 56) |
    36                 ((n & 0xff00) << 40) |
    37                 ((n & 0xff0000) << 24) |
    38                 ((n & 0xff000000LL) << 8) |
    39                 ((n & 0xff00000000LL) >>8) |
    40                 ((n & 0xff0000000000LL) >> 24) |
    41                 ((n & 0xff000000000000LL) >> 40) |
    42                 ((n & 0xff00000000000000LL) >> 56);
     38        return __u64_byteorder_swap(n);
    4339}
    4440
    45 static inline __native native_le2host(__native n)
     41static inline __native __native_le2host(__native n)
    4642{
    47         return ((n & 0xff) << 24) |
    48                 ((n & 0xff00) << 8) |
    49                 ((n & 0xff0000) >> 8) |
    50                 ((n & 0xff000000) >> 24);
     43        return __u32_byteroder_swap(n);
    5144}
     45
    5246#else
    53 #  define native_le2host(n)             (n)
    54 #  define u64_le2host(n)                (n)
     47#  define __native_le2host(n)           (n)
     48#  define __u64_le2host(n)              (n)
    5549#endif
    5650
Note: See TracChangeset for help on using the changeset viewer.