diff options
author | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2004-09-23 07:23:26 +0000 |
---|---|---|
committer | Joakim Tjernlund <joakim.tjernlund@transmode.se> | 2004-09-23 07:23:26 +0000 |
commit | e6c7d1de2a601b0c630df62e02c27a05962669d8 (patch) | |
tree | 55cdd7f9bc15daf363a7c6570ef85b1843b3de0a /libc/sysdeps | |
parent | 553bc05e524989e5e7567a07240900375067f9ff (diff) |
Add bswap_64 macro and uClibc_page.h. From Peter Kjellerstedt.
Diffstat (limited to 'libc/sysdeps')
-rw-r--r-- | libc/sysdeps/linux/cris/bits/byteswap.h | 27 | ||||
-rw-r--r-- | libc/sysdeps/linux/cris/bits/uClibc_page.h | 28 |
2 files changed, 55 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/cris/bits/byteswap.h b/libc/sysdeps/linux/cris/bits/byteswap.h index f152d73e8..e35c4b63f 100644 --- a/libc/sysdeps/linux/cris/bits/byteswap.h +++ b/libc/sysdeps/linux/cris/bits/byteswap.h @@ -45,4 +45,31 @@ static inline unsigned long __fswab32(unsigned long x) ___swab32((x)) : \ __fswab32((x))) +#if defined __GNUC__ && __GNUC__ >= 2 +/* Swap bytes in 64 bit value. */ +# define __bswap_constant_64(x) \ + ((((x) & 0xff00000000000000ull) >> 56) \ + | (((x) & 0x00ff000000000000ull) >> 40) \ + | (((x) & 0x0000ff0000000000ull) >> 24) \ + | (((x) & 0x000000ff00000000ull) >> 8) \ + | (((x) & 0x00000000ff000000ull) << 8) \ + | (((x) & 0x0000000000ff0000ull) << 24) \ + | (((x) & 0x000000000000ff00ull) << 40) \ + | (((x) & 0x00000000000000ffull) << 56)) + +# define __bswap_64(x) \ + (__extension__ \ + ({ union { __extension__ unsigned long long int __ll; \ + unsigned int __l[2]; } __w, __r; \ + if (__builtin_constant_p (x)) \ + __r.__ll = __bswap_constant_64 (x); \ + else \ + { \ + __w.__ll = (x); \ + __r.__l[0] = __bswap_32 (__w.__l[1]); \ + __r.__l[1] = __bswap_32 (__w.__l[0]); \ + } \ + __r.__ll; })) +#endif + #endif /* _BITS_BYTESWAP_H */ diff --git a/libc/sysdeps/linux/cris/bits/uClibc_page.h b/libc/sysdeps/linux/cris/bits/uClibc_page.h new file mode 100644 index 000000000..8219a19da --- /dev/null +++ b/libc/sysdeps/linux/cris/bits/uClibc_page.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2004 Erik Andersen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Supply an architecture specific value for PAGE_SIZE and friends. */ + +#ifndef _UCLIBC_PAGE_H +#define _UCLIBC_PAGE_H + +/* PAGE_SHIFT determines the page size -- in this case 8192 */ +#define PAGE_SHIFT 13 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#endif /* _UCLIBC_PAGE_H */ |