git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use faster byte swapping when compiling with MSVC

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 20, 2009, 07:04 UTC
Message-ID
<7vzl7mr1f5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<hbi4mt$tjt$1@ger.gmane.org>
Sebastian Schuberth <sschuberth@gmail.com> writes:
Show 5 quoted lines
> When compiling with MSVC on x86-compatible, use an intrinsic for byte swapping.
> In contrast to the GCC path, we do not prefer inline assembly here as it is not
> supported for the x64 platform.
>
> Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>

Unlike the other one this is not Acked by Marius, Dscho, or J6t; should I pick this up myself, or should I wait to be fed by one of msysgit people?

Show 27 quoted lines
> ---
>  compat/bswap.h |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/compat/bswap.h b/compat/bswap.h
> index 5cc4acb..279e0b4 100644
> --- a/compat/bswap.h
> +++ b/compat/bswap.h
> @@ -28,6 +28,16 @@ static inline uint32_t default_swab32(uint32_t val)
>  	} \
>  	__res; })
>  
> +#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
> +
> +#include <stdlib.h>
> +
> +#define bswap32(x) _byteswap_ulong(x)
> +
> +#endif
> +
> +#ifdef bswap32
> +
>  #undef ntohl
>  #undef htonl
>  #define ntohl(x) bswap32(x)
> -- 
> 1.6.5.rc2.13.g1be2
Previous: Sebastian SchuberthNext: Sebastian Schuberth
Message 2 of 7 in “Use faster byte swapping when compiling with MSVC”
  1. Use faster byte swapping when compiling with MSVCSebastian Schuberth, Oct 19, 2009
  2. Junio C HamanoOct 20, 2009
  3. Sebastian SchuberthOct 20, 2009
  4. Johannes SchindelinOct 20, 2009
  5. Junio C HamanoOct 20, 2009
  6. Ludvig StrigeusOct 20, 2009
  7. Erik Faye-LundOct 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.