Re: [PATCH] abuse of macros in swab.h

From: Giuliano Pochini (pochini@denise.shiny.it)
Date: Thu Sep 21 2000 - 21:50:46 EDT

  • Next message: aprasad@in.ibm.com: "problem with kmalloc"

    > +static inline __u64 ___swab16(__u64 x)
    > +{
    > + return (__u64)((x & (__u64)0x00000000000000ffULL) << 56) |
    > + (__u64)((x & (__u64)0x000000000000ff00ULL) << 40) |
    > + (__u64)((x & (__u64)0x0000000000ff0000ULL) << 24) |
    > + (__u64)((x & (__u64)0x00000000ff000000ULL) << 8) |
    > + (__u64)((x & (__u64)0x000000ff00000000ULL) >> 8) |
    > + (__u64)((x & (__u64)0x0000ff0000000000ULL) >> 24) |
    > + (__u64)((x & (__u64)0x00ff000000000000ULL) >> 40) |
    > + (__u64)((x & (__u64)0xff00000000000000ULL) >> 56);
    > +}

    And something like this ?

    static inline __u64 ___swab16(__u64 x){
    __u64 n;
      n = (x>>32) | (x<<32);
      n = ((n & 0x0000ffff0000ffffLL)<<16) | (n & 0xffff0000ffff0000LL)>>16;
      n = ((n & 0x00ff00ff00ff00ffLL)<<8) | (n & 0xff00ff00ff00ff00LL)>>8;
      return(n);
    }

    Bye.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 10:24:20 EDT