diff options
| author | Matt Fleming <matt.fleming@intel.com> | 2012-12-07 11:33:45 +0000 |
|---|---|---|
| committer | Matt Fleming <matt.fleming@intel.com> | 2012-12-07 11:33:45 +0000 |
| commit | 10f6cf6eef0a7da7dad1933efdbfb101155792d0 (patch) | |
| tree | d8ee3bfc6e55e739e0f135cd6d945955c670dd46 /extlinux/misc.h | |
| parent | 35928ee37da523e5f992cc462a4a4193d0bfaa4c (diff) | |
| parent | ddb10ce99c327888ade4d2ba3e4c50ad12aaa059 (diff) | |
| download | syslinux-6.00-pre3.tar.gz | |
Merge tag 'syslinux-5.00' into firmwaresyslinux-6.00-pre3
Conflicts:
Makefile
com32/elflink/ldlinux/Makefile
com32/lib/sys/module/elf_module.c
core/cleanup.c
core/comboot.inc
core/conio.c
core/fs/fs.c
core/init.c
core/mem/free.c
core/mem/malloc.c
core/timer.inc
diag/geodsp/Makefile
extlinux/main.c
mk/embedded.mk
modules/Makefile
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'extlinux/misc.h')
| -rw-r--r-- | extlinux/misc.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/extlinux/misc.h b/extlinux/misc.h new file mode 100644 index 00000000..7f2f1b33 --- /dev/null +++ b/extlinux/misc.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2012 Paulo Alcantara <pcacjr@zytor.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it would be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MISC_H_ +#define MISC_H_ + +/* Return a 64-bit litte-endian value from a given 64-bit big-endian one */ +static inline uint64_t be64_to_cpu(uint64_t val) +{ + return (uint64_t)((((uint64_t)val & (uint64_t)0x00000000000000ffULL) << 56) | + (((uint64_t)val & (uint64_t)0x000000000000ff00ULL) << 40) | + (((uint64_t)val & (uint64_t)0x0000000000ff0000ULL) << 24) | + (((uint64_t)val & (uint64_t)0x00000000ff000000ULL) << 8) | + (((uint64_t)val & (uint64_t)0x000000ff00000000ULL) >> 8) | + (((uint64_t)val & (uint64_t)0x0000ff0000000000ULL) >> 24) | + (((uint64_t)val & (uint64_t)0x00ff000000000000ULL) >> 40) | + (((uint64_t)val & (uint64_t)0xff00000000000000ULL) >> 56)); +} + +/* Return a 32-bit litte-endian value from a given 32-bit big-endian one */ +static inline uint32_t be32_to_cpu(uint32_t val) +{ + return (uint32_t)((((uint32_t)val & (uint32_t)0x000000ffUL) << 24) | + (((uint32_t)val & (uint32_t)0x0000ff00UL) << 8) | + (((uint32_t)val & (uint32_t)0x00ff0000UL) >> 8) | + (((uint32_t)val & (uint32_t)0xff000000UL) >> 24)); +} + +/* Return a 16-bit litte-endian value from a given 16-bit big-endian one */ +static inline uint16_t be16_to_cpu(uint16_t val) +{ + return (uint16_t)((((uint16_t)val & (uint16_t)0x00ffU) << 8) | + (((uint16_t)val & (uint16_t)0xff00U) >> 8)); +} + +#endif /* MISC_H_ */ |
