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

Re: [PATCH] block-sha1: Windows declares ntohl() in winsock2.h

From
Nicolas Pitre <nico@cam.org>
Date
Aug 18, 2009, 18:10 UTC
Message-ID
<alpine.LFD.2.00.0908181403190.6044@xanadu.home>
In-Reply-To
<bdca99240908180959h69f37671k4d526fbf4814e8d1@mail.gmail.com>
On Tue, 18 Aug 2009, Sebastian Schuberth wrote:
Show 11 quoted lines
> On Tue, Aug 18, 2009 at 18:43, Nicolas Pitre<nico@cam.org> wrote:
> 
> >> Well...  Given that git already uses ntohl/htonl quite extensively in
> >> its core already, I'd suggest making this more globally available
> >> instead.
> >
> > What about something like this?
> 
> I like the idea of making bswap available more globally, but I'm not
> sure if it's worth to introduce a new file for only that purpose.
> Isn't there already a central header for such things?

That central header is already quite crowded. A bit of isolation might not hurt.

Furthermore, other platforms might wish to add their own (re)definitions for those byte swap operations, so it has the potential to grow. I for example have a better implementation for ARM than what is provided by glibc. (Yeah yeah, maybe glibc should be fixed instead, but that reasoning goes for all those other libraries too).

> Moreover, including compat/bswap.h would only give you ntohl()/htonl()
> on one platform. For consistency, I'd expect to get those for any
> platform if I include compat/bswap.h, but maybe I'm not aware of some
> Git source code rules.

You get it by default for all platforms already by including git-compat-util.h. The compat/bswap.h is not meant to be included by random c files. If compat/bswap.h happens to contain a better version for your architecture then it'll override the default one.

> Finally, there's a typo in your comment saying "sinple" instead of "simple".
Thanks
Nicolas
Previous: Nicolas Pitre
Message 34 of 34 in “block-sha1: Windows declares ntohl() in winsock2.h”
  1. block-sha1: Windows declares ntohl() in winsock2.hJohannes Sixt, Aug 18, 2009
  2. Sebastian SchuberthAug 18, 2009
  3. Junio C HamanoAug 18, 2009
  4. Sebastian SchuberthAug 18, 2009
  5. Artur SkawinaAug 18, 2009
  6. Sebastian SchuberthAug 18, 2009
  7. Junio C HamanoAug 18, 2009
  8. Linus TorvaldsAug 18, 2009
  9. Linus TorvaldsAug 18, 2009
  10. Sebastian SchuberthAug 18, 2009
  11. Junio C HamanoAug 18, 2009
  12. Nicolas PitreAug 18, 2009
  13. Nicolas PitreAug 18, 2009
  14. Junio C HamanoAug 18, 2009
  15. Nicolas PitreAug 18, 2009
  16. Junio C HamanoAug 18, 2009
  17. Nicolas PitreAug 18, 2009
  18. make sure byte swapping is optimal for gitNicolas Pitre, Aug 18, 2009
  19. block-sha1: guard gcc extensions with __GNUC__Nicolas Pitre, Aug 18, 2009
  20. Junio C HamanoAug 18, 2009
  21. Brandon CaseyAug 18, 2009
  22. Nicolas PitreAug 18, 2009
  23. Linus TorvaldsAug 18, 2009
  24. Brandon CaseyAug 18, 2009
  25. Nicolas PitreAug 20, 2009
  26. Linus TorvaldsAug 20, 2009
  27. Brandon CaseyAug 20, 2009
  28. Sebastian SchuberthAug 18, 2009
  29. Junio C HamanoAug 18, 2009
  30. Nicolas PitreAug 18, 2009
  31. Junio C HamanoAug 18, 2009
  32. Junio C HamanoAug 18, 2009
  33. Nicolas PitreAug 18, 2009
  34. Nicolas PitreAug 18, 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.