Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

Wrong check for Windows and presence of byteswap.h header #46

Description

@thomaskejser

In city.cc this following check is done to check if we are on Windows.

#ifdef _MSC_VER

#include <stdlib.h>
#define bswap_32(x) _byteswap_ulong(x)
#define bswap_64(x) _byteswap_uint64(x)

However, this is not the correct way to check for Windows. Above only checks for the presence of the MSVC tool chain.

Clang on Windows and MinGW do not set this macro - which means that CityHash cannot compile with these tool chains on Windows.

The correct way to check that works on all Windows compiler tool chains:

#if defined(_WIN22)
#include <stdlib.h>
#define bswap_32(x) _byteswap_ulong(x)
#define bswap_64(x) _byteswap_uint64(x)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions