[m-rev.] for review: Check C compiler supports __builtin_bswap functions.

Julien Fischer jfischer at opturion.com
Mon Mar 19 15:13:35 AEDT 2018


Hi Peter,

The diff is fine — UU is indeed a typo.

Julien.

On Monday, 19 March 2018, Peter Wang <novalazy at gmail.com> wrote:

> On Mon, 19 Mar 2018 14:40:59 +1100, Peter Wang <novalazy at gmail.com> wrote:
> > diff --git a/runtime/mercury_conf.h.in b/runtime/mercury_conf.h.in
> > index 8801b6805..b7b613f17 100644
> > --- a/runtime/mercury_conf.h.in
> > +++ b/runtime/mercury_conf.h.in
> > @@ -363,6 +363,9 @@
> >  #undef  MR_HAVE_FINITE
> >  #undef  MR_HAVE_FESETROUND
> >  #undef  MR_HAVE_FMA
> > +#undef  MR_HAVE_BUILTIN_BSWAP16
> > +#undef  MR_HAVE_BUILTIN_BSWAP32
> > +#undef  MR_HAVE_BUILTIN_BSWAP64
>
> I've now added comments describing these macros above.
>
> > diff --git a/runtime/mercury_int.h b/runtime/mercury_int.h
> > index bb8fbdf6f..9620953ff 100644
> > --- a/runtime/mercury_int.h
> > +++ b/runtime/mercury_int.h
> > @@ -94,7 +94,7 @@
> >  extern MR_Integer MR_hash_int64(int64_t);
> >  extern MR_Integer MR_hash_uint64(uint64_t);
> >
> > -#if defined(MR_GNUC) || defined(MR_CLANG)
> > +#if defined(MR_HAVE_BUILTIN_BSWAP16)
> >    #define MR_uint16_reverse_bytes(U) __builtin_bswap16((U))
> >  #elif defined(MR_MSVC)
> >    #define MR_uint16_reverse_bytes(U) _byteswap_ushort((U))
> > @@ -103,7 +103,7 @@ extern MR_Integer MR_hash_uint64(uint64_t);
> >                                        ((U & 0x00ff) << 8))
> >  #endif
> >
> > -#if defined(MR_GNUC) || defined(MR_CLANG)
> > +#if defined(MR_HAVE_BUILTIN_BSWAP32)
> >    #define MR_uint32_reverse_bytes(U) __builtin_bswap32((U))
> >  #elif defined(MR_MSVC)
> >    #define MR_uint32_reverse_bytes(U) _byteswap_ulong((U))
> > @@ -114,7 +114,7 @@ extern MR_Integer MR_hash_uint64(uint64_t);
> >                                        (U & UINT32_C(0xff000000)) >> 24 )
> >  #endif
> >
> > -#if defined(MR_GNUC) || defined(MR_CLANG)
> > +#if defined(MR_HAVE_BUILTIN_BSWAP64)
> >    #define MR_uint64_reverse_bytes(U) __builtin_bswap64((U))
> >  #elif defined(MR_MSVC)
> >    #define MR_uint64_reverse_bytes(U) _byteswap_uint64((UU))
>
> UU is a typo, yes?
>
> Peter
> _______________________________________________
> reviews mailing list
> reviews at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/reviews
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20180319/ed5af3fc/attachment.html>


More information about the reviews mailing list