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

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:35

Sebastian Schuberth [off-list ref] writes:
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 <redacted>
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?

quoted hunk
---
 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

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

From: Sebastian Schuberth <hidden>
Date: 2016-06-15 22:47:35

On Tue, Oct 20, 2009 at 09:04, Junio C Hamano [off-list ref] wrote:
quoted
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 <redacted>
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?
Well, in fact I am one of the msysgit poeple, although I mostly worked
on the installer until now. In general, I like my patches to be
reviewed, but this one is rather uncritical, I guess. So it's up to
you, Junio, I'm perfectly OK with waiting for an ACK.

-- 
Sebastian Schuberth

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

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:47:35

Hi,

On Tue, 20 Oct 2009, Sebastian Schuberth wrote:
On Tue, Oct 20, 2009 at 09:04, Junio C Hamano [off-list ref] wrote:
quoted
quoted
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 <redacted>
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?
Well, in fact I am one of the msysgit poeple, although I mostly worked 
on the installer until now. In general, I like my patches to be 
reviewed, but this one is rather uncritical, I guess. So it's up to you, 
Junio, I'm perfectly OK with waiting for an ACK.
Apart from the fact that I do not have MSVC (and I don't want it, either), 
there is another strong reason why I think Sebastian does not need ACKs or 
SOBs on MSVC patches: he has plenty of experience as a maintainer of a 
rather big (commercial) software that has to compile on Windows, MacOSX 
and several Unix-type OSes (and it is known that Sebastian is a Windows 
guy).

So I would trust Sebastian's patches (at least when it comes to MSVC) 
without even reviewing them.

Ciao,
Dscho

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:35

Johannes Schindelin [off-list ref] writes:
quoted
Well, in fact I am one of the msysgit poeple, although I mostly worked 
on the installer until now. In general, I like my patches to be 
reviewed, but this one is rather uncritical, I guess. So it's up to you, 
Junio, I'm perfectly OK with waiting for an ACK.
Apart from the fact that I do not have MSVC (and I don't want it, either), 
there is another strong reason why I think Sebastian does not need ACKs or 
SOBs on MSVC patches: he has plenty of experience as a maintainer of a 
rather big (commercial) software that has to compile on Windows, MacOSX 
and several Unix-type OSes (and it is known that Sebastian is a Windows 
guy).

So I would trust Sebastian's patches (at least when it comes to MSVC) 
without even reviewing them.
I very appreciate a strong Ack in a specific area like this.  I do skim
msysgit list from time to time, and in retrospect I realize I _could_ have
recognized Sebastian's name but somehow it didn't click.

I guess I should apply both patches to 'master', then.  Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help