These two modules implement the stdc_store8_* functions from the ISO C2y draft.


2026-03-13  Bruno Haible  <[email protected]>

        stdc_store8: Add tests.
        * tests/test-stdc_store8.c: New file, based on
        tests/test-stdc_store8_aligned.c.
        * modules/stdc_store8-tests: New file.

        stdc_store8: New module.
        * lib/stdbit.in.h (_GL_STDC_STORE8_INLINE): New macro.
        (stdc_store8_beu{8,16,32,64}, stdc_store8_leu{8,16,32,64},
        stdc_store8_bes{8,16,32,64}, stdc_store8_les{8,16,32,64}): New
        functions.
        * lib/stdc_store8.c: New file.
        * m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_STDC_STORE8.
        * modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8.
        * modules/stdc_store8: New file.
        * doc/posix-functions/stdc_store8_beu8.texi: Mention the new module.
        * doc/posix-functions/stdc_store8_beu16.texi: Likewise.
        * doc/posix-functions/stdc_store8_beu32.texi: Likewise.
        * doc/posix-functions/stdc_store8_beu64.texi: Likewise.
        * doc/posix-functions/stdc_store8_leu8.texi: Likewise.
        * doc/posix-functions/stdc_store8_leu16.texi: Likewise.
        * doc/posix-functions/stdc_store8_leu32.texi: Likewise.
        * doc/posix-functions/stdc_store8_leu64.texi: Likewise.
        * doc/posix-functions/stdc_store8_bes8.texi: Likewise.
        * doc/posix-functions/stdc_store8_bes16.texi: Likewise.
        * doc/posix-functions/stdc_store8_bes32.texi: Likewise.
        * doc/posix-functions/stdc_store8_bes64.texi: Likewise.
        * doc/posix-functions/stdc_store8_les8.texi: Likewise.
        * doc/posix-functions/stdc_store8_les16.texi: Likewise.
        * doc/posix-functions/stdc_store8_les32.texi: Likewise.
        * doc/posix-functions/stdc_store8_les64.texi: Likewise.

2026-03-13  Bruno Haible  <[email protected]>

        stdc_store8_aligned: Add tests.
        * tests/test-stdc_store8_aligned.c: New file.
        * modules/stdc_store8_aligned-tests: New file.

        stdc_store8_aligned: New module.
        * lib/stdbit.in.h (_GL_STDC_STORE8_ALIGNED_INLINE): New macro.
        (stdc_store8_aligned_beu{8,16,32,64},
        stdc_store8_aligned_leu{8,16,32,64},
        stdc_store8_aligned_bes{8,16,32,64},
        stdc_store8_aligned_les{8,16,32,64}): New functions.
        * lib/stdc_store8_aligned.c: New file.
        * m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
        GNULIB_STDC_STORE8_ALIGNED.
        * modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8_ALIGNED.
        * modules/stdc_store8_aligned: New file.
        * doc/posix-functions/stdc_store8_aligned_beu8.texi: Mention the new
        module.
        * doc/posix-functions/stdc_store8_aligned_beu16.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_beu32.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_beu64.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_leu8.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_leu16.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_leu32.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_leu64.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_bes8.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_bes16.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_bes32.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_bes64.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_les8.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_les16.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_les32.texi: Likewise.
        * doc/posix-functions/stdc_store8_aligned_les64.texi: Likewise.

From b48c4f8a1858c810e02a8b7ac2178f2a8beaa831 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 13 Mar 2026 07:57:41 +0100
Subject: [PATCH 1/4] stdc_store8_aligned: New module.

* lib/stdbit.in.h (_GL_STDC_STORE8_ALIGNED_INLINE): New macro.
(stdc_store8_aligned_beu{8,16,32,64},
stdc_store8_aligned_leu{8,16,32,64},
stdc_store8_aligned_bes{8,16,32,64},
stdc_store8_aligned_les{8,16,32,64}): New functions.
* lib/stdc_store8_aligned.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_STORE8_ALIGNED.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8_ALIGNED.
* modules/stdc_store8_aligned: New file.
* doc/posix-functions/stdc_store8_aligned_beu8.texi: Mention the new
module.
* doc/posix-functions/stdc_store8_aligned_beu16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_beu32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_beu64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les64.texi: Likewise.
---
 ChangeLog                                     |  31 ++++
 .../stdc_store8_aligned_bes16.texi            |   9 +-
 .../stdc_store8_aligned_bes32.texi            |   9 +-
 .../stdc_store8_aligned_bes64.texi            |   9 +-
 .../stdc_store8_aligned_bes8.texi             |   9 +-
 .../stdc_store8_aligned_beu16.texi            |   9 +-
 .../stdc_store8_aligned_beu32.texi            |   9 +-
 .../stdc_store8_aligned_beu64.texi            |   9 +-
 .../stdc_store8_aligned_beu8.texi             |   9 +-
 .../stdc_store8_aligned_les16.texi            |   9 +-
 .../stdc_store8_aligned_les32.texi            |   9 +-
 .../stdc_store8_aligned_les64.texi            |   9 +-
 .../stdc_store8_aligned_les8.texi             |   9 +-
 .../stdc_store8_aligned_leu16.texi            |   9 +-
 .../stdc_store8_aligned_leu32.texi            |   9 +-
 .../stdc_store8_aligned_leu64.texi            |   9 +-
 .../stdc_store8_aligned_leu8.texi             |   9 +-
 lib/stdbit.in.h                               | 158 +++++++++++++++++-
 lib/stdc_store8_aligned.c                     |  19 +++
 m4/stdbit_h.m4                                |   3 +-
 modules/stdbit-h                              |   1 +
 modules/stdc_store8_aligned                   |  28 ++++
 22 files changed, 317 insertions(+), 67 deletions(-)
 create mode 100644 lib/stdc_store8_aligned.c
 create mode 100644 modules/stdc_store8_aligned

diff --git a/ChangeLog b/ChangeLog
index e9a7699cd5..2cd402329a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+2026-03-13  Bruno Haible  <[email protected]>
+
+	stdc_store8_aligned: New module.
+	* lib/stdbit.in.h (_GL_STDC_STORE8_ALIGNED_INLINE): New macro.
+	(stdc_store8_aligned_beu{8,16,32,64},
+	stdc_store8_aligned_leu{8,16,32,64},
+	stdc_store8_aligned_bes{8,16,32,64},
+	stdc_store8_aligned_les{8,16,32,64}): New functions.
+	* lib/stdc_store8_aligned.c: New file.
+	* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_STDC_STORE8_ALIGNED.
+	* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8_ALIGNED.
+	* modules/stdc_store8_aligned: New file.
+	* doc/posix-functions/stdc_store8_aligned_beu8.texi: Mention the new
+	module.
+	* doc/posix-functions/stdc_store8_aligned_beu16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_beu32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_beu64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_leu8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_leu16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_leu32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_leu64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_bes8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_bes16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_bes32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_bes64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_les8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_les16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_les32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_aligned_les64.texi: Likewise.
+
 2026-03-12  Bruno Haible  <[email protected]>
 
 	stdc_load8: Add tests.
diff --git a/doc/posix-functions/stdc_store8_aligned_bes16.texi b/doc/posix-functions/stdc_store8_aligned_bes16.texi
index fb1a561023..7dc7d157b1 100644
--- a/doc/posix-functions/stdc_store8_aligned_bes16.texi
+++ b/doc/posix-functions/stdc_store8_aligned_bes16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_bes32.texi b/doc/posix-functions/stdc_store8_aligned_bes32.texi
index c63a3cf536..181fc1a7ce 100644
--- a/doc/posix-functions/stdc_store8_aligned_bes32.texi
+++ b/doc/posix-functions/stdc_store8_aligned_bes32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_bes64.texi b/doc/posix-functions/stdc_store8_aligned_bes64.texi
index 98bc64a801..ecf3cf5e0f 100644
--- a/doc/posix-functions/stdc_store8_aligned_bes64.texi
+++ b/doc/posix-functions/stdc_store8_aligned_bes64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_bes8.texi b/doc/posix-functions/stdc_store8_aligned_bes8.texi
index 9afde30bec..0d8816739b 100644
--- a/doc/posix-functions/stdc_store8_aligned_bes8.texi
+++ b/doc/posix-functions/stdc_store8_aligned_bes8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_beu16.texi b/doc/posix-functions/stdc_store8_aligned_beu16.texi
index e8bf9146bc..b0a4386f28 100644
--- a/doc/posix-functions/stdc_store8_aligned_beu16.texi
+++ b/doc/posix-functions/stdc_store8_aligned_beu16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_beu32.texi b/doc/posix-functions/stdc_store8_aligned_beu32.texi
index 12c04e5acf..7b2cdf4406 100644
--- a/doc/posix-functions/stdc_store8_aligned_beu32.texi
+++ b/doc/posix-functions/stdc_store8_aligned_beu32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_beu64.texi b/doc/posix-functions/stdc_store8_aligned_beu64.texi
index 7f2610904c..0090ff874a 100644
--- a/doc/posix-functions/stdc_store8_aligned_beu64.texi
+++ b/doc/posix-functions/stdc_store8_aligned_beu64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_beu8.texi b/doc/posix-functions/stdc_store8_aligned_beu8.texi
index 0b041d720c..9577f8cd12 100644
--- a/doc/posix-functions/stdc_store8_aligned_beu8.texi
+++ b/doc/posix-functions/stdc_store8_aligned_beu8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_les16.texi b/doc/posix-functions/stdc_store8_aligned_les16.texi
index 2baedca869..0b526d0cf8 100644
--- a/doc/posix-functions/stdc_store8_aligned_les16.texi
+++ b/doc/posix-functions/stdc_store8_aligned_les16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_les32.texi b/doc/posix-functions/stdc_store8_aligned_les32.texi
index d980b326ff..9c1bb7661a 100644
--- a/doc/posix-functions/stdc_store8_aligned_les32.texi
+++ b/doc/posix-functions/stdc_store8_aligned_les32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_les64.texi b/doc/posix-functions/stdc_store8_aligned_les64.texi
index 6a9c7b320a..ba2dc1e360 100644
--- a/doc/posix-functions/stdc_store8_aligned_les64.texi
+++ b/doc/posix-functions/stdc_store8_aligned_les64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_les8.texi b/doc/posix-functions/stdc_store8_aligned_les8.texi
index f96be35047..9f2870aa39 100644
--- a/doc/posix-functions/stdc_store8_aligned_les8.texi
+++ b/doc/posix-functions/stdc_store8_aligned_les8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_leu16.texi b/doc/posix-functions/stdc_store8_aligned_leu16.texi
index d76c399ece..a2a9e1593c 100644
--- a/doc/posix-functions/stdc_store8_aligned_leu16.texi
+++ b/doc/posix-functions/stdc_store8_aligned_leu16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_leu32.texi b/doc/posix-functions/stdc_store8_aligned_leu32.texi
index 1f9969f923..66c1fdeb54 100644
--- a/doc/posix-functions/stdc_store8_aligned_leu32.texi
+++ b/doc/posix-functions/stdc_store8_aligned_leu32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_leu64.texi b/doc/posix-functions/stdc_store8_aligned_leu64.texi
index 274b2d2877..613ee7f952 100644
--- a/doc/posix-functions/stdc_store8_aligned_leu64.texi
+++ b/doc/posix-functions/stdc_store8_aligned_leu64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_aligned_leu8.texi b/doc/posix-functions/stdc_store8_aligned_leu8.texi
index ed451473f1..78c38d77cd 100644
--- a/doc/posix-functions/stdc_store8_aligned_leu8.texi
+++ b/doc/posix-functions/stdc_store8_aligned_leu8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8_aligned
+@mindex stdc_store8_aligned
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h
index e171606e25..37e1566884 100644
--- a/lib/stdbit.in.h
+++ b/lib/stdbit.in.h
@@ -37,7 +37,7 @@
  #error "Please include config.h first."
 #endif
 
-#if @GNULIB_STDC_LOAD8_ALIGNED@ || @GNULIB_STDC_LOAD8@
+#if @GNULIB_STDC_LOAD8_ALIGNED@ || @GNULIB_STDC_LOAD8@ || @GNULIB_STDC_STORE8_ALIGNED@
 
 /* Get int_least8_t, int_least16_t, int_least32_t, int_least64_t,
    uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t.  */
@@ -45,7 +45,7 @@
 
 #endif
 
-#if @GNULIB_STDC_LOAD8_ALIGNED@
+#if @GNULIB_STDC_LOAD8_ALIGNED@ || @GNULIB_STDC_STORE8_ALIGNED@
 
 /* Get bswap_16, bswap_32, bswap_64.  */
 # include <byteswap.h>
@@ -105,6 +105,9 @@ _GL_INLINE_HEADER_BEGIN
 #ifndef _GL_STDC_LOAD8_INLINE
 # define _GL_STDC_LOAD8_INLINE _GL_INLINE
 #endif
+#ifndef _GL_STDC_STORE8_ALIGNED_INLINE
+# define _GL_STDC_STORE8_ALIGNED_INLINE _GL_INLINE
+#endif
 
 /* An expression, preferably with the type of A, that has the value of B.  */
 #if ((defined __GNUC__ && 2 <= __GNUC__) \
@@ -1390,6 +1393,157 @@ stdc_load8_les64 (const unsigned char ptr[8])
 #endif
 
 
+/* ISO C2y ?? 7.18.22 Endian-Aware 8-Bit Store  */
+
+#if @GNULIB_STDC_STORE8_ALIGNED@
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_beu8 (uint_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = value;
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_beu16 (uint_least16_t value, unsigned char ptr[2])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint16_t *)ptr = value;
+# else
+  *(uint16_t *)ptr = bswap_16 (value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_beu32 (uint_least32_t value, unsigned char ptr[4])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint32_t *)ptr = value;
+# else
+  *(uint32_t *)ptr = bswap_32 (value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_beu64 (uint_least64_t value, unsigned char ptr[8])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint64_t *)ptr = value;
+# else
+  *(uint64_t *)ptr = bswap_64 (value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_leu8 (uint_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = value;
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_leu16 (uint_least16_t value, unsigned char ptr[2])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint16_t *)ptr = bswap_16 (value);
+# else
+  *(uint16_t *)ptr = value;
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_leu32 (uint_least32_t value, unsigned char ptr[4])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint32_t *)ptr = bswap_32 (value);
+# else
+  *(uint32_t *)ptr = value;
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_leu64 (uint_least64_t value, unsigned char ptr[8])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint64_t *)ptr = bswap_64 (value);
+# else
+  *(uint64_t *)ptr = value;
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_bes8 (int_least8_t value, unsigned char ptr[1])
+{
+  *(signed char *)ptr = value;
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_bes16 (int_least16_t value, unsigned char ptr[2])
+{
+# ifdef WORDS_BIGENDIAN
+  *(int16_t *)ptr = value;
+# else
+  *(uint16_t *)ptr = bswap_16 ((uint16_t) value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_bes32 (int_least32_t value, unsigned char ptr[4])
+{
+# ifdef WORDS_BIGENDIAN
+  *(int32_t *)ptr = value;
+# else
+  *(uint32_t *)ptr = bswap_32 ((uint32_t) value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_bes64 (int_least64_t value, unsigned char ptr[8])
+{
+# ifdef WORDS_BIGENDIAN
+  *(int64_t *)ptr = value;
+# else
+  *(uint64_t *)ptr = bswap_64 ((uint64_t) value);
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_les8 (int_least8_t value, unsigned char ptr[1])
+{
+  *(signed char *)ptr = value;
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_les16 (int_least16_t value, unsigned char ptr[2])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint16_t *)ptr = bswap_16 ((uint16_t) value);
+# else
+  *(int16_t *)ptr = value;
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_les32 (int_least32_t value, unsigned char ptr[4])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint32_t *)ptr = bswap_32 ((uint32_t) value);
+# else
+  *(int32_t *)ptr = value;
+# endif
+}
+
+_GL_STDC_STORE8_ALIGNED_INLINE void
+stdc_store8_aligned_les64 (int_least64_t value, unsigned char ptr[8])
+{
+# ifdef WORDS_BIGENDIAN
+  *(uint64_t *)ptr = bswap_64 ((uint64_t) value);
+# else
+  *(int64_t *)ptr = value;
+# endif
+}
+
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/stdc_store8_aligned.c b/lib/stdc_store8_aligned.c
new file mode 100644
index 0000000000..cb36d064a5
--- /dev/null
+++ b/lib/stdc_store8_aligned.c
@@ -0,0 +1,19 @@
+/* stdc_store8_aligned_* functions.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define _GL_STDC_STORE8_ALIGNED_INLINE _GL_EXTERN_INLINE
+#include <config.h>
+#include <stdbit.h>
diff --git a/m4/stdbit_h.m4 b/m4/stdbit_h.m4
index 7872902b6c..5aba49e055 100644
--- a/m4/stdbit_h.m4
+++ b/m4/stdbit_h.m4
@@ -1,5 +1,5 @@
 # stdbit_h.m4
-# serial 7
+# serial 8
 dnl Copyright 2024-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -68,6 +68,7 @@ AC_DEFUN([gl_STDBIT_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_BIT_CEIL])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8_ALIGNED])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_STORE8_ALIGNED])
   ])
   m4_require(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS])
   AC_REQUIRE([gl_STDBIT_H_DEFAULTS])
diff --git a/modules/stdbit-h b/modules/stdbit-h
index 2e4ca2ebcc..f937e29551 100644
--- a/modules/stdbit-h
+++ b/modules/stdbit-h
@@ -48,6 +48,7 @@ stdbit.h: stdbit.in.h $(top_builddir)/config.status
 	  -e 's/@''GNULIB_STDC_BIT_CEIL''@/$(GNULIB_STDC_BIT_CEIL)/g' \
 	  -e 's/@''GNULIB_STDC_LOAD8_ALIGNED''@/$(GNULIB_STDC_LOAD8_ALIGNED)/g' \
 	  -e 's/@''GNULIB_STDC_LOAD8''@/$(GNULIB_STDC_LOAD8)/g' \
+	  -e 's/@''GNULIB_STDC_STORE8_ALIGNED''@/$(GNULIB_STDC_STORE8_ALIGNED)/g' \
 	  $(srcdir)/stdbit.in.h > $@-t
 	$(AM_V_at)mv $@-t $@
 lib_SOURCES += stdbit.c
diff --git a/modules/stdc_store8_aligned b/modules/stdc_store8_aligned
new file mode 100644
index 0000000000..b5463eb410
--- /dev/null
+++ b/modules/stdc_store8_aligned
@@ -0,0 +1,28 @@
+Description:
+stdc_store8_aligned_* functions: Endian-aware storing of a few bytes.
+
+Files:
+lib/stdc_store8_aligned.c
+
+Depends-on:
+stdbit-h
+stdint-h
+byteswap
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+gl_STDBIT_MODULE_INDICATOR([stdc_store8_aligned])
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_store8_aligned.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
-- 
2.52.0

>From f526033fc599c3be40f2cf311f0c8684f35ee0bb Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 13 Mar 2026 08:13:57 +0100
Subject: [PATCH 2/4] stdc_store8_aligned: Add tests.

* tests/test-stdc_store8_aligned.c: New file.
* modules/stdc_store8_aligned-tests: New file.
---
 ChangeLog                         |   4 +
 modules/stdc_store8_aligned-tests |  11 ++
 tests/test-stdc_store8_aligned.c  | 218 ++++++++++++++++++++++++++++++
 3 files changed, 233 insertions(+)
 create mode 100644 modules/stdc_store8_aligned-tests
 create mode 100644 tests/test-stdc_store8_aligned.c

diff --git a/ChangeLog b/ChangeLog
index 2cd402329a..426fdd5268 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2026-03-13  Bruno Haible  <[email protected]>
 
+	stdc_store8_aligned: Add tests.
+	* tests/test-stdc_store8_aligned.c: New file.
+	* modules/stdc_store8_aligned-tests: New file.
+
 	stdc_store8_aligned: New module.
 	* lib/stdbit.in.h (_GL_STDC_STORE8_ALIGNED_INLINE): New macro.
 	(stdc_store8_aligned_beu{8,16,32,64},
diff --git a/modules/stdc_store8_aligned-tests b/modules/stdc_store8_aligned-tests
new file mode 100644
index 0000000000..b55e4cfb66
--- /dev/null
+++ b/modules/stdc_store8_aligned-tests
@@ -0,0 +1,11 @@
+Files:
+tests/test-stdc_store8_aligned.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_store8_aligned
+check_PROGRAMS += test-stdc_store8_aligned
diff --git a/tests/test-stdc_store8_aligned.c b/tests/test-stdc_store8_aligned.c
new file mode 100644
index 0000000000..97bc4d174a
--- /dev/null
+++ b/tests/test-stdc_store8_aligned.c
@@ -0,0 +1,218 @@
+/* Test of stdc_store8_aligned_* functions.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+
+   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, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2026.  */
+
+#include <config.h>
+
+#include <stdbit.h>
+
+#include "macros.h"
+
+static void
+test_stdc_store8_aligned_beu8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_aligned_beu8 (0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_aligned_beu16 (void)
+{
+  static union { unsigned char bytes[2]; uint16_t align; } data;
+  stdc_store8_aligned_beu16 (0xD5E6, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_aligned_beu32 (void)
+{
+  static union { unsigned char bytes[4]; uint32_t align; } data;
+  stdc_store8_aligned_beu32 (0xD5E6C2F4U, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_aligned_beu64 (void)
+{
+  static union { unsigned char bytes[8]; uint64_t align; } data;
+  stdc_store8_aligned_beu64 (0xD5E6C2F4F1C9EADFULL, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_aligned_leu8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_aligned_leu8 (0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_aligned_leu16 (void)
+{
+  static union { unsigned char bytes[2]; uint16_t align; } data;
+  stdc_store8_aligned_leu16 (0xE6D5, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_aligned_leu32 (void)
+{
+  static union { unsigned char bytes[4]; uint32_t align; } data;
+  stdc_store8_aligned_leu32 (0xF4C2E6D5U, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_aligned_leu64 (void)
+{
+  static union { unsigned char bytes[8]; uint64_t align; } data;
+  stdc_store8_aligned_leu64 (0xDFEAC9F1F4C2E6D5ULL, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_aligned_bes8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_aligned_bes8 ((int8_t) 0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_aligned_bes16 (void)
+{
+  static union { unsigned char bytes[2]; uint16_t align; } data;
+  stdc_store8_aligned_bes16 ((int16_t) 0xD5E6, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_aligned_bes32 (void)
+{
+  static union { unsigned char bytes[4]; uint32_t align; } data;
+  stdc_store8_aligned_bes32 (0xD5E6C2F4, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_aligned_bes64 (void)
+{
+  static union { unsigned char bytes[8]; uint64_t align; } data;
+  stdc_store8_aligned_bes64 (0xD5E6C2F4F1C9EADFLL, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_aligned_les8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_aligned_les8 ((int8_t) 0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_aligned_les16 (void)
+{
+  static union { unsigned char bytes[2]; uint16_t align; } data;
+  stdc_store8_aligned_les16 ((int16_t) 0xE6D5, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_aligned_les32 (void)
+{
+  static union { unsigned char bytes[4]; uint32_t align; } data;
+  stdc_store8_aligned_les32 (0xF4C2E6D5, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_aligned_les64 (void)
+{
+  static union { unsigned char bytes[8]; uint64_t align; } data;
+  stdc_store8_aligned_les64 (0xDFEAC9F1F4C2E6D5LL, data.bytes);
+  ASSERT (data.bytes[0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[7] == (unsigned char) 0xDF);
+}
+
+int
+main ()
+{
+  test_stdc_store8_aligned_beu8 ();
+  test_stdc_store8_aligned_beu16 ();
+  test_stdc_store8_aligned_beu32 ();
+  test_stdc_store8_aligned_beu64 ();
+  test_stdc_store8_aligned_leu8 ();
+  test_stdc_store8_aligned_leu16 ();
+  test_stdc_store8_aligned_leu32 ();
+  test_stdc_store8_aligned_leu64 ();
+  test_stdc_store8_aligned_bes8 ();
+  test_stdc_store8_aligned_bes16 ();
+  test_stdc_store8_aligned_bes32 ();
+  test_stdc_store8_aligned_bes64 ();
+  test_stdc_store8_aligned_les8 ();
+  test_stdc_store8_aligned_les16 ();
+  test_stdc_store8_aligned_les32 ();
+  test_stdc_store8_aligned_les64 ();
+
+  return test_exit_status;
+}
-- 
2.52.0

>From 00f3819ced9466c559f1d5705fdc018a7bcbd8ab Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 13 Mar 2026 08:48:11 +0100
Subject: [PATCH 3/4] stdc_store8: New module.

* lib/stdbit.in.h (_GL_STDC_STORE8_INLINE): New macro.
(stdc_store8_beu{8,16,32,64}, stdc_store8_leu{8,16,32,64},
stdc_store8_bes{8,16,32,64}, stdc_store8_les{8,16,32,64}): New
functions.
* lib/stdc_store8.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_STORE8.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8.
* modules/stdc_store8: New file.
* doc/posix-functions/stdc_store8_beu8.texi: Mention the new module.
* doc/posix-functions/stdc_store8_beu16.texi: Likewise.
* doc/posix-functions/stdc_store8_beu32.texi: Likewise.
* doc/posix-functions/stdc_store8_beu64.texi: Likewise.
* doc/posix-functions/stdc_store8_leu8.texi: Likewise.
* doc/posix-functions/stdc_store8_leu16.texi: Likewise.
* doc/posix-functions/stdc_store8_leu32.texi: Likewise.
* doc/posix-functions/stdc_store8_leu64.texi: Likewise.
* doc/posix-functions/stdc_store8_bes8.texi: Likewise.
* doc/posix-functions/stdc_store8_bes16.texi: Likewise.
* doc/posix-functions/stdc_store8_bes32.texi: Likewise.
* doc/posix-functions/stdc_store8_bes64.texi: Likewise.
* doc/posix-functions/stdc_store8_les8.texi: Likewise.
* doc/posix-functions/stdc_store8_les16.texi: Likewise.
* doc/posix-functions/stdc_store8_les32.texi: Likewise.
* doc/posix-functions/stdc_store8_les64.texi: Likewise.
---
 ChangeLog                                  |  29 ++++
 doc/posix-functions/stdc_store8_bes16.texi |   9 +-
 doc/posix-functions/stdc_store8_bes32.texi |   9 +-
 doc/posix-functions/stdc_store8_bes64.texi |   9 +-
 doc/posix-functions/stdc_store8_bes8.texi  |   9 +-
 doc/posix-functions/stdc_store8_beu16.texi |   9 +-
 doc/posix-functions/stdc_store8_beu32.texi |   9 +-
 doc/posix-functions/stdc_store8_beu64.texi |   9 +-
 doc/posix-functions/stdc_store8_beu8.texi  |   9 +-
 doc/posix-functions/stdc_store8_les16.texi |   9 +-
 doc/posix-functions/stdc_store8_les32.texi |   9 +-
 doc/posix-functions/stdc_store8_les64.texi |   9 +-
 doc/posix-functions/stdc_store8_les8.texi  |   9 +-
 doc/posix-functions/stdc_store8_leu16.texi |   9 +-
 doc/posix-functions/stdc_store8_leu32.texi |   9 +-
 doc/posix-functions/stdc_store8_leu64.texi |   9 +-
 doc/posix-functions/stdc_store8_leu8.texi  |   9 +-
 lib/stdbit.in.h                            | 149 ++++++++++++++++++++-
 lib/stdc_store8.c                          |  19 +++
 m4/stdbit_h.m4                             |   3 +-
 modules/stdbit-h                           |   1 +
 modules/stdc_store8                        |  27 ++++
 22 files changed, 306 insertions(+), 66 deletions(-)
 create mode 100644 lib/stdc_store8.c
 create mode 100644 modules/stdc_store8

diff --git a/ChangeLog b/ChangeLog
index 426fdd5268..ec44c52490 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2026-03-13  Bruno Haible  <[email protected]>
+
+	stdc_store8: New module.
+	* lib/stdbit.in.h (_GL_STDC_STORE8_INLINE): New macro.
+	(stdc_store8_beu{8,16,32,64}, stdc_store8_leu{8,16,32,64},
+	stdc_store8_bes{8,16,32,64}, stdc_store8_les{8,16,32,64}): New
+	functions.
+	* lib/stdc_store8.c: New file.
+	* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
+	GNULIB_STDC_STORE8.
+	* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8.
+	* modules/stdc_store8: New file.
+	* doc/posix-functions/stdc_store8_beu8.texi: Mention the new module.
+	* doc/posix-functions/stdc_store8_beu16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_beu32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_beu64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_leu8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_leu16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_leu32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_leu64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_bes8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_bes16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_bes32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_bes64.texi: Likewise.
+	* doc/posix-functions/stdc_store8_les8.texi: Likewise.
+	* doc/posix-functions/stdc_store8_les16.texi: Likewise.
+	* doc/posix-functions/stdc_store8_les32.texi: Likewise.
+	* doc/posix-functions/stdc_store8_les64.texi: Likewise.
+
 2026-03-13  Bruno Haible  <[email protected]>
 
 	stdc_store8_aligned: Add tests.
diff --git a/doc/posix-functions/stdc_store8_bes16.texi b/doc/posix-functions/stdc_store8_bes16.texi
index e8af3c45d7..66f838600a 100644
--- a/doc/posix-functions/stdc_store8_bes16.texi
+++ b/doc/posix-functions/stdc_store8_bes16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_bes32.texi b/doc/posix-functions/stdc_store8_bes32.texi
index be2b9b53fa..fc9b34c481 100644
--- a/doc/posix-functions/stdc_store8_bes32.texi
+++ b/doc/posix-functions/stdc_store8_bes32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_bes64.texi b/doc/posix-functions/stdc_store8_bes64.texi
index 6f77edc501..b6934ce26e 100644
--- a/doc/posix-functions/stdc_store8_bes64.texi
+++ b/doc/posix-functions/stdc_store8_bes64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_bes8.texi b/doc/posix-functions/stdc_store8_bes8.texi
index 7debec3993..ed56d3373e 100644
--- a/doc/posix-functions/stdc_store8_bes8.texi
+++ b/doc/posix-functions/stdc_store8_bes8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_beu16.texi b/doc/posix-functions/stdc_store8_beu16.texi
index 00d00aad29..bc3a750071 100644
--- a/doc/posix-functions/stdc_store8_beu16.texi
+++ b/doc/posix-functions/stdc_store8_beu16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_beu32.texi b/doc/posix-functions/stdc_store8_beu32.texi
index 2d25616a89..80eb762b19 100644
--- a/doc/posix-functions/stdc_store8_beu32.texi
+++ b/doc/posix-functions/stdc_store8_beu32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_beu64.texi b/doc/posix-functions/stdc_store8_beu64.texi
index 7686edccdd..ac46c85da1 100644
--- a/doc/posix-functions/stdc_store8_beu64.texi
+++ b/doc/posix-functions/stdc_store8_beu64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_beu8.texi b/doc/posix-functions/stdc_store8_beu8.texi
index 53dbb0bbef..939a07c326 100644
--- a/doc/posix-functions/stdc_store8_beu8.texi
+++ b/doc/posix-functions/stdc_store8_beu8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_les16.texi b/doc/posix-functions/stdc_store8_les16.texi
index c77b18f0b0..85f1f01518 100644
--- a/doc/posix-functions/stdc_store8_les16.texi
+++ b/doc/posix-functions/stdc_store8_les16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_les32.texi b/doc/posix-functions/stdc_store8_les32.texi
index 608719ee81..576a84acb4 100644
--- a/doc/posix-functions/stdc_store8_les32.texi
+++ b/doc/posix-functions/stdc_store8_les32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_les64.texi b/doc/posix-functions/stdc_store8_les64.texi
index d22cd71188..ee74ed07e5 100644
--- a/doc/posix-functions/stdc_store8_les64.texi
+++ b/doc/posix-functions/stdc_store8_les64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_les8.texi b/doc/posix-functions/stdc_store8_les8.texi
index 754a2ca980..81eb675a26 100644
--- a/doc/posix-functions/stdc_store8_les8.texi
+++ b/doc/posix-functions/stdc_store8_les8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_leu16.texi b/doc/posix-functions/stdc_store8_leu16.texi
index 9a5539e6d7..ea52f8428a 100644
--- a/doc/posix-functions/stdc_store8_leu16.texi
+++ b/doc/posix-functions/stdc_store8_leu16.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_leu32.texi b/doc/posix-functions/stdc_store8_leu32.texi
index 9571868e67..939e39af33 100644
--- a/doc/posix-functions/stdc_store8_leu32.texi
+++ b/doc/posix-functions/stdc_store8_leu32.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_leu64.texi b/doc/posix-functions/stdc_store8_leu64.texi
index 230a038baf..091583f7ab 100644
--- a/doc/posix-functions/stdc_store8_leu64.texi
+++ b/doc/posix-functions/stdc_store8_leu64.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/doc/posix-functions/stdc_store8_leu8.texi b/doc/posix-functions/stdc_store8_leu8.texi
index a406bfe29c..e730936c2c 100644
--- a/doc/posix-functions/stdc_store8_leu8.texi
+++ b/doc/posix-functions/stdc_store8_leu8.texi
@@ -7,15 +7,16 @@
 @url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3783.pdf})
 section 7.18.22.
 
-Gnulib module: ---
+Gnulib module: stdc_store8
+@mindex stdc_store8
 
 Portability problems fixed by Gnulib:
 @itemize
+@item
+This function is missing on many platforms:
+glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
-@item
-This function is missing on many platforms:
-glibc 2.43, macOS 26, FreeBSD 15.0, NetBSD 10.0, OpenBSD 7.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, Cygwin 3.5.3, mingw, MSVC 17, Android 15.
 @end itemize
diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h
index 37e1566884..db3f072b49 100644
--- a/lib/stdbit.in.h
+++ b/lib/stdbit.in.h
@@ -37,7 +37,7 @@
  #error "Please include config.h first."
 #endif
 
-#if @GNULIB_STDC_LOAD8_ALIGNED@ || @GNULIB_STDC_LOAD8@ || @GNULIB_STDC_STORE8_ALIGNED@
+#if @GNULIB_STDC_LOAD8_ALIGNED@ || @GNULIB_STDC_LOAD8@ || @GNULIB_STDC_STORE8_ALIGNED@ || @GNULIB_STDC_STORE8@
 
 /* Get int_least8_t, int_least16_t, int_least32_t, int_least64_t,
    uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t.  */
@@ -108,6 +108,9 @@ _GL_INLINE_HEADER_BEGIN
 #ifndef _GL_STDC_STORE8_ALIGNED_INLINE
 # define _GL_STDC_STORE8_ALIGNED_INLINE _GL_INLINE
 #endif
+#ifndef _GL_STDC_STORE8_INLINE
+# define _GL_STDC_STORE8_INLINE _GL_INLINE
+#endif
 
 /* An expression, preferably with the type of A, that has the value of B.  */
 #if ((defined __GNUC__ && 2 <= __GNUC__) \
@@ -1543,6 +1546,150 @@ stdc_store8_aligned_les64 (int_least64_t value, unsigned char ptr[8])
 
 #endif
 
+#if @GNULIB_STDC_STORE8@
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_beu8 (uint_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = value;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_beu16 (uint_least16_t value, unsigned char ptr[2])
+{
+  ptr[0] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[1] = (unsigned char) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_beu32 (uint_least32_t value, unsigned char ptr[4])
+{
+  ptr[0] = (unsigned char) (value >> 24) & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 16) & 0xFFU;
+  ptr[2] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[3] = (unsigned char) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_beu64 (uint_least64_t value, unsigned char ptr[8])
+{
+  ptr[0] = (unsigned char) (value >> 56) & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 48) & 0xFFU;
+  ptr[2] = (unsigned char) (value >> 40) & 0xFFU;
+  ptr[3] = (unsigned char) (value >> 32) & 0xFFU;
+  ptr[4] = (unsigned char) (value >> 24) & 0xFFU;
+  ptr[5] = (unsigned char) (value >> 16) & 0xFFU;
+  ptr[6] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[7] = (unsigned char) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_leu8 (uint_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = value;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_leu16 (uint_least16_t value, unsigned char ptr[2])
+{
+  ptr[0] = (unsigned char) value & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 8) & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_leu32 (uint_least32_t value, unsigned char ptr[4])
+{
+  ptr[0] = (unsigned char) value & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[2] = (unsigned char) (value >> 16) & 0xFFU;
+  ptr[3] = (unsigned char) (value >> 24) & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_leu64 (uint_least64_t value, unsigned char ptr[8])
+{
+  ptr[0] = (unsigned char) value & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[2] = (unsigned char) (value >> 16) & 0xFFU;
+  ptr[3] = (unsigned char) (value >> 24) & 0xFFU;
+  ptr[4] = (unsigned char) (value >> 32) & 0xFFU;
+  ptr[5] = (unsigned char) (value >> 40) & 0xFFU;
+  ptr[6] = (unsigned char) (value >> 48) & 0xFFU;
+  ptr[7] = (unsigned char) (value >> 56) & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_bes8 (int_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = (unsigned char) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_bes16 (int_least16_t value, unsigned char ptr[2])
+{
+  ptr[0] = (unsigned char) (value >> 8) & 0xFFU;
+  ptr[1] = (unsigned char) (uint_least16_t) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_bes32 (int_least32_t value, unsigned char ptr[4])
+{
+  ptr[0] = (unsigned char) (value >> 24) & 0xFFU;
+  ptr[1] = (unsigned char) ((uint_least32_t) value >> 16) & 0xFFU;
+  ptr[2] = (unsigned char) ((uint_least32_t) value >> 8) & 0xFFU;
+  ptr[3] = (unsigned char) (uint_least32_t) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_bes64 (int_least64_t value, unsigned char ptr[8])
+{
+  ptr[0] = (unsigned char) (value >> 56) & 0xFFU;
+  ptr[1] = (unsigned char) ((uint_least64_t) value >> 48) & 0xFFU;
+  ptr[2] = (unsigned char) ((uint_least64_t) value >> 40) & 0xFFU;
+  ptr[3] = (unsigned char) ((uint_least64_t) value >> 32) & 0xFFU;
+  ptr[4] = (unsigned char) ((uint_least64_t) value >> 24) & 0xFFU;
+  ptr[5] = (unsigned char) ((uint_least64_t) value >> 16) & 0xFFU;
+  ptr[6] = (unsigned char) ((uint_least64_t) value >> 8) & 0xFFU;
+  ptr[7] = (unsigned char) (uint_least64_t) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_les8 (int_least8_t value, unsigned char ptr[1])
+{
+  ptr[0] = (unsigned char) value & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_les16 (int_least16_t value, unsigned char ptr[2])
+{
+  ptr[0] = (unsigned char) (uint_least16_t) value & 0xFFU;
+  ptr[1] = (unsigned char) (value >> 8) & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_les32 (int_least32_t value, unsigned char ptr[4])
+{
+  ptr[0] = (unsigned char) (uint_least32_t) value & 0xFFU;
+  ptr[1] = (unsigned char) ((uint_least32_t) value >> 8) & 0xFFU;
+  ptr[2] = (unsigned char) ((uint_least32_t) value >> 16) & 0xFFU;
+  ptr[3] = (unsigned char) (value >> 24) & 0xFFU;
+}
+
+_GL_STDC_STORE8_INLINE void
+stdc_store8_les64 (int_least64_t value, unsigned char ptr[8])
+{
+  ptr[0] = (unsigned char) (uint_least64_t) value & 0xFFU;
+  ptr[1] = (unsigned char) ((uint_least64_t) value >> 8) & 0xFFU;
+  ptr[2] = (unsigned char) ((uint_least64_t) value >> 16) & 0xFFU;
+  ptr[3] = (unsigned char) ((uint_least64_t) value >> 24) & 0xFFU;
+  ptr[4] = (unsigned char) ((uint_least64_t) value >> 32) & 0xFFU;
+  ptr[5] = (unsigned char) ((uint_least64_t) value >> 40) & 0xFFU;
+  ptr[6] = (unsigned char) ((uint_least64_t) value >> 48) & 0xFFU;
+  ptr[7] = (unsigned char) (value >> 56) & 0xFFU;
+}
+
+#endif
+
 
 #ifdef __cplusplus
 }
diff --git a/lib/stdc_store8.c b/lib/stdc_store8.c
new file mode 100644
index 0000000000..9b437df2b4
--- /dev/null
+++ b/lib/stdc_store8.c
@@ -0,0 +1,19 @@
+/* stdc_store8_* (unaligned) functions.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as
+   published by the Free Software Foundation; either version 2.1 of the
+   License, or (at your option) any later version.
+
+   This file 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 Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#define _GL_STDC_STORE8_INLINE _GL_EXTERN_INLINE
+#include <config.h>
+#include <stdbit.h>
diff --git a/m4/stdbit_h.m4 b/m4/stdbit_h.m4
index 5aba49e055..3f2804ac17 100644
--- a/m4/stdbit_h.m4
+++ b/m4/stdbit_h.m4
@@ -1,5 +1,5 @@
 # stdbit_h.m4
-# serial 8
+# serial 9
 dnl Copyright 2024-2026 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -69,6 +69,7 @@ AC_DEFUN([gl_STDBIT_H_REQUIRE_DEFAULTS]
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8_ALIGNED])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_LOAD8])
     gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_STORE8_ALIGNED])
+    gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDC_STORE8])
   ])
   m4_require(GL_MODULE_INDICATOR_PREFIX[_STDBIT_H_MODULE_INDICATOR_DEFAULTS])
   AC_REQUIRE([gl_STDBIT_H_DEFAULTS])
diff --git a/modules/stdbit-h b/modules/stdbit-h
index f937e29551..9ea678de01 100644
--- a/modules/stdbit-h
+++ b/modules/stdbit-h
@@ -49,6 +49,7 @@ stdbit.h: stdbit.in.h $(top_builddir)/config.status
 	  -e 's/@''GNULIB_STDC_LOAD8_ALIGNED''@/$(GNULIB_STDC_LOAD8_ALIGNED)/g' \
 	  -e 's/@''GNULIB_STDC_LOAD8''@/$(GNULIB_STDC_LOAD8)/g' \
 	  -e 's/@''GNULIB_STDC_STORE8_ALIGNED''@/$(GNULIB_STDC_STORE8_ALIGNED)/g' \
+	  -e 's/@''GNULIB_STDC_STORE8''@/$(GNULIB_STDC_STORE8)/g' \
 	  $(srcdir)/stdbit.in.h > $@-t
 	$(AM_V_at)mv $@-t $@
 lib_SOURCES += stdbit.c
diff --git a/modules/stdc_store8 b/modules/stdc_store8
new file mode 100644
index 0000000000..cb7d0f19be
--- /dev/null
+++ b/modules/stdc_store8
@@ -0,0 +1,27 @@
+Description:
+stdc_store8_* (unaligned) functions: Endian-aware storing of a few bytes.
+
+Files:
+lib/stdc_store8.c
+
+Depends-on:
+stdbit-h
+stdint-h
+
+configure.ac:
+AC_REQUIRE([gl_STDBIT_H])
+gl_STDBIT_MODULE_INDICATOR([stdc_store8])
+
+Makefile.am:
+if GL_GENERATE_STDBIT_H
+lib_SOURCES += stdc_store8.c
+endif
+
+Include:
+<stdbit.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all
-- 
2.52.0

>From 7c1559af224969275107aa080397a2554d6fb644 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Fri, 13 Mar 2026 09:07:17 +0100
Subject: [PATCH 4/4] stdc_store8: Add tests.

* tests/test-stdc_store8.c: New file, based on
tests/test-stdc_store8_aligned.c.
* modules/stdc_store8-tests: New file.
---
 ChangeLog                 |   5 +
 modules/stdc_store8-tests |  11 ++
 tests/test-stdc_store8.c  | 218 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 234 insertions(+)
 create mode 100644 modules/stdc_store8-tests
 create mode 100644 tests/test-stdc_store8.c

diff --git a/ChangeLog b/ChangeLog
index ec44c52490..f9e257f459 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2026-03-13  Bruno Haible  <[email protected]>
 
+	stdc_store8: Add tests.
+	* tests/test-stdc_store8.c: New file, based on
+	tests/test-stdc_store8_aligned.c.
+	* modules/stdc_store8-tests: New file.
+
 	stdc_store8: New module.
 	* lib/stdbit.in.h (_GL_STDC_STORE8_INLINE): New macro.
 	(stdc_store8_beu{8,16,32,64}, stdc_store8_leu{8,16,32,64},
diff --git a/modules/stdc_store8-tests b/modules/stdc_store8-tests
new file mode 100644
index 0000000000..403efe084d
--- /dev/null
+++ b/modules/stdc_store8-tests
@@ -0,0 +1,11 @@
+Files:
+tests/test-stdc_store8.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-stdc_store8
+check_PROGRAMS += test-stdc_store8
diff --git a/tests/test-stdc_store8.c b/tests/test-stdc_store8.c
new file mode 100644
index 0000000000..d2ac34194c
--- /dev/null
+++ b/tests/test-stdc_store8.c
@@ -0,0 +1,218 @@
+/* Test of stdc_store8_* (unaligned) functions.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+
+   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, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program 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 General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <[email protected]>, 2026.  */
+
+#include <config.h>
+
+#include <stdbit.h>
+
+#include "macros.h"
+
+static void
+test_stdc_store8_beu8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_beu8 (0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_beu16 (void)
+{
+  static union { unsigned char bytes[1 + 2]; uint16_t align; } data;
+  stdc_store8_beu16 (0xD5E6, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_beu32 (void)
+{
+  static union { unsigned char bytes[1 + 4]; uint32_t align; } data;
+  stdc_store8_beu32 (0xD5E6C2F4U, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_beu64 (void)
+{
+  static union { unsigned char bytes[1 + 8]; uint64_t align; } data;
+  stdc_store8_beu64 (0xD5E6C2F4F1C9EADFULL, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[1 + 4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[1 + 5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[1 + 6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[1 + 7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_leu8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_leu8 (0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_leu16 (void)
+{
+  static union { unsigned char bytes[1 + 2]; uint16_t align; } data;
+  stdc_store8_leu16 (0xE6D5, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_leu32 (void)
+{
+  static union { unsigned char bytes[1 + 4]; uint32_t align; } data;
+  stdc_store8_leu32 (0xF4C2E6D5U, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_leu64 (void)
+{
+  static union { unsigned char bytes[1 + 8]; uint64_t align; } data;
+  stdc_store8_leu64 (0xDFEAC9F1F4C2E6D5ULL, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[1 + 4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[1 + 5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[1 + 6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[1 + 7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_bes8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_bes8 ((int8_t) 0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_bes16 (void)
+{
+  static union { unsigned char bytes[1 + 2]; uint16_t align; } data;
+  stdc_store8_bes16 ((int16_t) 0xD5E6, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_bes32 (void)
+{
+  static union { unsigned char bytes[1 + 4]; uint32_t align; } data;
+  stdc_store8_bes32 (0xD5E6C2F4, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_bes64 (void)
+{
+  static union { unsigned char bytes[1 + 8]; uint64_t align; } data;
+  stdc_store8_bes64 (0xD5E6C2F4F1C9EADFLL, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[1 + 4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[1 + 5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[1 + 6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[1 + 7] == (unsigned char) 0xDF);
+}
+
+static void
+test_stdc_store8_les8 (void)
+{
+  static unsigned char data[1];
+  stdc_store8_les8 ((int8_t) 0xD5, data);
+  ASSERT (data[0] == (unsigned char) 0xD5);
+}
+
+static void
+test_stdc_store8_les16 (void)
+{
+  static union { unsigned char bytes[1 + 2]; uint16_t align; } data;
+  stdc_store8_les16 ((int16_t) 0xE6D5, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+}
+
+static void
+test_stdc_store8_les32 (void)
+{
+  static union { unsigned char bytes[1 + 4]; uint32_t align; } data;
+  stdc_store8_les32 (0xF4C2E6D5, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+}
+
+static void
+test_stdc_store8_les64 (void)
+{
+  static union { unsigned char bytes[1 + 8]; uint64_t align; } data;
+  stdc_store8_les64 (0xDFEAC9F1F4C2E6D5LL, data.bytes + 1);
+  ASSERT (data.bytes[1 + 0] == (unsigned char) 0xD5);
+  ASSERT (data.bytes[1 + 1] == (unsigned char) 0xE6);
+  ASSERT (data.bytes[1 + 2] == (unsigned char) 0xC2);
+  ASSERT (data.bytes[1 + 3] == (unsigned char) 0xF4);
+  ASSERT (data.bytes[1 + 4] == (unsigned char) 0xF1);
+  ASSERT (data.bytes[1 + 5] == (unsigned char) 0xC9);
+  ASSERT (data.bytes[1 + 6] == (unsigned char) 0xEA);
+  ASSERT (data.bytes[1 + 7] == (unsigned char) 0xDF);
+}
+
+int
+main ()
+{
+  test_stdc_store8_beu8 ();
+  test_stdc_store8_beu16 ();
+  test_stdc_store8_beu32 ();
+  test_stdc_store8_beu64 ();
+  test_stdc_store8_leu8 ();
+  test_stdc_store8_leu16 ();
+  test_stdc_store8_leu32 ();
+  test_stdc_store8_leu64 ();
+  test_stdc_store8_bes8 ();
+  test_stdc_store8_bes16 ();
+  test_stdc_store8_bes32 ();
+  test_stdc_store8_bes64 ();
+  test_stdc_store8_les8 ();
+  test_stdc_store8_les16 ();
+  test_stdc_store8_les32 ();
+  test_stdc_store8_les64 ();
+
+  return test_exit_status;
+}
-- 
2.52.0

Reply via email to