[vlc-devel] [PATCH] vlc_common: Provide an unreachable() implementation for MSVC
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 4 07:36:53 UTC 2021
LGTM
A little background https://docs.microsoft.com/en-us/cpp/intrinsics/assume
It's supported since VS 2015
On 2020-12-18 15:13, Hugo Beauzée-Luyssen wrote:
> ---
> include/vlc_common.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index d65a076d45..f62ff86d04 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -203,6 +203,10 @@
> # define likely(p) __builtin_expect(!!(p), 1)
> # define unlikely(p) __builtin_expect(!!(p), 0)
> # define unreachable() __builtin_unreachable()
> +#elif defined(_MSC_VER)
> +# define likely(p) (!!(p))
> +# define unlikely(p) (!!(p))
> +# define unreachable() (__assume(0))
> #else
> /**
> * Predicted true condition
> --
> 2.29.2
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list