[FFmpeg-devel] [PATCH 02/23] compat: add a fallback implementation of C23 stdbit.h

James Almer jamrial at gmail.com
Sat Sep 14 16:10:06 EEST 2024


On 9/14/2024 7:45 AM, Anton Khirnov wrote:
> From: Rémi Denis-Courmont <remi at remlab.net>
> 
> Header contents taken from VLC commit 7a970a33329c9836d169727ddbaf49a33240d587.
> 
> Signed-off-by: Anton Khirnov <anton at khirnov.net>
> ---
>   compat/stdbit/stdbit.h | 594 +++++++++++++++++++++++++++++++++++++++++
>   configure              |   4 +
>   tests/ref/fate/source  |   1 +
>   3 files changed, 599 insertions(+)
>   create mode 100644 compat/stdbit/stdbit.h
> 
> diff --git a/compat/stdbit/stdbit.h b/compat/stdbit/stdbit.h
> new file mode 100644
> index 0000000000..b6a2c7e945
> --- /dev/null
> +++ b/compat/stdbit/stdbit.h
> @@ -0,0 +1,594 @@
> +/*
> + * Copyright (C) 2023 Rémi Denis-Courmont
> + *
> + * This program 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 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 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, write to the Free Software Foundation,
> + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
> + */
> +
> +#ifndef __STDC_VERSION_STDBIT_H__
> +#define __STDC_VERSION_STDBIT_H__ 202311L
> +
> +#include <stdbool.h>
> +#include <limits.h> /* CHAR_BIT */
> +
> +#define __STDC_ENDIAN_LITTLE__ 1234
> +#define __STDC_ENDIAN_BIG__    4321
> +
> +#ifdef __BYTE_ORDER__

This doesn't seem to be defined in msvc. I looked at VLC and their CI 
seems to use gcc only for Windows, which would explain why it's written 
as is.

It should be safe to just hardcode little endian for it (or Windows in 
general, even for aarch64).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240914/3679c001/attachment.sig>


More information about the ffmpeg-devel mailing list