diff options
Diffstat (limited to 'libc')
-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 */ |