summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2025-09-11 17:19:29 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2025-09-11 17:19:29 +0200
commit50d223b12c1319b4b9c4a5b8e34866c46996cb36 (patch)
tree1d8d7297afaa443f7945c9c3fe6668cc816c8ffe
parentcec79a3f5578da4a9f9085282389482edf45c81b (diff)
New upstream version 4.27upstream/4.27upstream
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/api.rst2
-rw-r--r--doc/changelog.rst8
-rw-r--r--include/Makefile.am3
-rw-r--r--include/Makefile.in3
-rw-r--r--include/libHX/endian_float.h107
-rw-r--r--src/tc-compile.c1
8 files changed, 133 insertions, 13 deletions
diff --git a/configure b/configure
index 4a42ae4..d1e34b1 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for libHX 4.26.
+# Generated by GNU Autoconf 2.72 for libHX 4.27.
#
#
# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation,
@@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libHX'
PACKAGE_TARNAME='libhx'
-PACKAGE_VERSION='4.26'
-PACKAGE_STRING='libHX 4.26'
+PACKAGE_VERSION='4.27'
+PACKAGE_STRING='libHX 4.27'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1372,7 +1372,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-'configure' configures libHX 4.26 to adapt to many kinds of systems.
+'configure' configures libHX 4.27 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1443,7 +1443,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libHX 4.26:";;
+ short | recursive ) echo "Configuration of libHX 4.27:";;
esac
cat <<\_ACEOF
@@ -1558,7 +1558,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libHX configure 4.26
+libHX configure 4.27
generated by GNU Autoconf 2.72
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2211,7 +2211,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libHX $as_me 4.26, which was
+It was created by libHX $as_me 4.27, which was
generated by GNU Autoconf 2.72. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3904,7 +3904,7 @@ fi
# Define the identity of the package.
PACKAGE='libhx'
- VERSION='4.26'
+ VERSION='4.27'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -19160,7 +19160,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libHX $as_me 4.26, which was
+This file was extended by libHX $as_me 4.27, which was
generated by GNU Autoconf 2.72. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19228,7 +19228,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-libHX config.status 4.26
+libHX config.status 4.27
configured by $0, generated by GNU Autoconf 2.72,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index bbc0537..1ae500c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([libHX], [4.26])
+AC_INIT([libHX], [4.27])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/doc/api.rst b/doc/api.rst
index 5b2161d..2579486 100644
--- a/doc/api.rst
+++ b/doc/api.rst
@@ -9,6 +9,8 @@ Function reference
====== ====== ====== ========================================
RMV MinVer FirstA Name
====== ====== ====== ========================================
+4.27 inline 4.27 float_cpu_to_{le,be}{32,64}p
+4.27 inline 4.27 float_{le,be}{32,64}p_to_cpu
4.25 inline 4.25 HX_isascii
4.25 inline 4.25 HX::make_scope_exit
4.25 inline 4.25 cpu_to_le{16,32,64}p cpu_to_be{16,32,64}p
diff --git a/doc/changelog.rst b/doc/changelog.rst
index f6f73f8..94708fb 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,3 +1,11 @@
+v4.27 (2025-03-17)
+==================
+
+Enhancements:
+
+* New header endian_float.h
+
+
v4.26 (2025-03-08)
==================
diff --git a/include/Makefile.am b/include/Makefile.am
index 82b8289..e3d3f86 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,7 +1,8 @@
# -*- Makefile -*-
nobase_include_HEADERS = libHX.h libHX/cast.h \
- libHX/ctype_helper.h libHX/defs.h libHX/deque.h libHX/endian.h libHX/init.h \
+ libHX/ctype_helper.h libHX/defs.h libHX/deque.h \
+ libHX/endian.h libHX/endian_float.h libHX/init.h \
libHX/intdiff.hpp libHX/io.h libHX/list.h \
libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \
libHX/scope.hpp libHX/socket.h libHX/string.h \
diff --git a/include/Makefile.in b/include/Makefile.in
index 0bfc881..7c0e74c 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -307,7 +307,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
nobase_include_HEADERS = libHX.h libHX/cast.h \
- libHX/ctype_helper.h libHX/defs.h libHX/deque.h libHX/endian.h libHX/init.h \
+ libHX/ctype_helper.h libHX/defs.h libHX/deque.h \
+ libHX/endian.h libHX/endian_float.h libHX/init.h \
libHX/intdiff.hpp libHX/io.h libHX/list.h \
libHX/map.h libHX/misc.h libHX/option.h libHX/proc.h \
libHX/scope.hpp libHX/socket.h libHX/string.h \
diff --git a/include/libHX/endian_float.h b/include/libHX/endian_float.h
new file mode 100644
index 0000000..f36e110
--- /dev/null
+++ b/include/libHX/endian_float.h
@@ -0,0 +1,107 @@
+#ifndef _LIBHX_ENDIAN_FLOAT_H
+#define _LIBHX_ENDIAN_FLOAT_H 1
+#include <string.h>
+#include <libHX/endian.h>
+
+/*
+ * While construction of integers from bytes was easy, it would be more work
+ * for floats — and compilers probably won't be able to optimize it.
+ *
+ * So then, we make some shortcuts/assumptions here in endian_float.h:
+ * - that the host platform uses the same byte order for integers as for floats
+ * - that the host platform is using IEEE754/IEC559
+ *
+ * This holds for the typical Linux on {arm gnueabi LE, arm gnueabi
+ * BE, aarch64 LE, aarch64 BE, i386, amd64, hppa, loongarch64, m68k,
+ * mips, ppc64, ppc64le, sparc, sparc64, riscv64, s390x}.
+ */
+
+/*
+ * Unlike cpu_to_be32, we will offer no float_cpu_to_be32. Values comprised of
+ * inverted bytes should probably not be passed around in memory.
+ */
+LIBHX_DBG_INLINE float LIBHX_OPT_O2 float_be32p_to_cpu(const void *p)
+{
+ uint32_t v = be32p_to_cpu(p);
+ float w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ return w;
+}
+
+LIBHX_DBG_INLINE double LIBHX_OPT_O2 float_le32p_to_cpu(const void *p)
+{
+ uint32_t v = le32p_to_cpu(p);
+ float w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ return w;
+}
+
+LIBHX_DBG_INLINE float LIBHX_OPT_O2 float_be64p_to_cpu(const void *p)
+{
+ uint64_t v = be64p_to_cpu(p);
+ double w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ return w;
+}
+
+LIBHX_DBG_INLINE double LIBHX_OPT_O2 float_le64p_to_cpu(const void *p)
+{
+ uint64_t v = le64p_to_cpu(p);
+ double w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ return w;
+}
+
+LIBHX_DBG_INLINE void LIBHX_OPT_O2 float_cpu_to_be32p(void *p, float v)
+{
+ uint32_t w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ cpu_to_be32p(p, w);
+}
+
+LIBHX_DBG_INLINE void LIBHX_OPT_O2 float_cpu_to_le32p(void *p, float v)
+{
+ uint32_t w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ cpu_to_le32p(p, w);
+}
+
+LIBHX_DBG_INLINE void LIBHX_OPT_O2 float_cpu_to_be64p(void *p, double v)
+{
+ uint64_t w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ cpu_to_be64p(p, w);
+}
+
+LIBHX_DBG_INLINE void LIBHX_OPT_O2 float_cpu_to_le64p(void *p, double v)
+{
+ uint64_t w;
+#ifdef __cplusplus
+ static_assert(sizeof(v) == sizeof(w));
+#endif
+ memcpy(&w, &v, sizeof(w));
+ cpu_to_le64p(p, w);
+}
+
+#endif /* _LIBHX_ENDIAN_FLOAT_H */
diff --git a/src/tc-compile.c b/src/tc-compile.c
index b3f3b0e..6aa38c4 100644
--- a/src/tc-compile.c
+++ b/src/tc-compile.c
@@ -6,6 +6,7 @@
#endif
#include <libHX.h>
#include <libHX/endian.h>
+#include <libHX/endian_float.h>
#define ZZ 64