From 4eed3157327f8406921658442a11af7e9d84d603 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 4 Oct 2013 00:36:22 -0700 Subject: Use hardware support for byteswapping on glibc x86 etc. On Fedora 19 x86-64, the new bswap_64 needs 1 instruction, whereas the old swap64 needed 30. * admin/merge-gnulib (GNULIB_MODULES): Add byteswap. * lib/byteswap.in.h, m4/byteswap.m4: New files, copied from Gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/fringe.c (init_fringe_bitmap) [WORDS_BIGENDIAN]: * src/sound.c (le2hl, le2hs, be2hl) [!WINDOWSNT]: Use byteswap.h's macros to swap bytes. * src/lisp.h (swap16, swap32, swap64): Remove. All uses replaced by bswap_16, bswap_32, bswap_64. --- m4/byteswap.m4 | 19 +++++++++++++++++++ m4/gnulib-comp.m4 | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 m4/byteswap.m4 (limited to 'm4') diff --git a/m4/byteswap.m4 b/m4/byteswap.m4 new file mode 100644 index 0000000000..7566903dc4 --- /dev/null +++ b/m4/byteswap.m4 @@ -0,0 +1,19 @@ +# byteswap.m4 serial 4 +dnl Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Oskar Liljeblad. + +AC_DEFUN([gl_BYTESWAP], +[ + dnl Prerequisites of lib/byteswap.in.h. + AC_CHECK_HEADERS([byteswap.h], [ + BYTESWAP_H='' + ], [ + BYTESWAP_H='byteswap.h' + ]) + AC_SUBST([BYTESWAP_H]) + AM_CONDITIONAL([GL_GENERATE_BYTESWAP_H], [test -n "$BYTESWAP_H"]) +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 2e5a9cf97d..ff36981c8d 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -42,6 +42,7 @@ AC_DEFUN([gl_EARLY], # Code from module allocator: # Code from module at-internal: # Code from module binary-io: + # Code from module byteswap: # Code from module c-ctype: # Code from module c-strcase: # Code from module careadlinkat: @@ -169,6 +170,7 @@ AC_DEFUN([gl_INIT], gl_COMMON gl_source_base='lib' gl_FUNC_ALLOCA + gl_BYTESWAP AC_CHECK_FUNCS_ONCE([readlinkat]) gl_CLOCK_TIME gl_CLOSE_STREAM @@ -794,6 +796,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/at-func.c lib/binary-io.c lib/binary-io.h + lib/byteswap.in.h lib/c-ctype.c lib/c-ctype.h lib/c-strcase.h @@ -912,6 +915,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/00gnulib.m4 m4/acl.m4 m4/alloca.m4 + m4/byteswap.m4 m4/c-strtod.m4 m4/clock_time.m4 m4/close-stream.m4 -- cgit v1.2.3