* 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-13 Bruno Haible <bruno@clisp.org>
+
+ 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 <bruno@clisp.org>
stdc_load8: Add tests.
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
@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
#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. */
#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>
#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__) \
#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
--- /dev/null
+/* 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>
# 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,
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])
-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
--- /dev/null
+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