Skip to content

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

@thomaskejser

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)

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