Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows/arm64 support, ensure unsupported platforms see a compile error #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/crill/bytewise_atomic_memcpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ namespace crill {

for (std::size_t i = 0; i < count; ++i) {
#if __cpp_lib_atomic_ref
dest_bytes[i] = std::atomic_ref<char>(src_bytes[i]).load(std::memory_order_relaxed);
dest_bytes[i] = std::atomic_ref<const char>(src_bytes[i]).load(std::memory_order_relaxed);
#elif CRILL_CLANG || CRILL_GCC
dest_bytes[i] = __atomic_load_n(src_bytes + i, __ATOMIC_RELAXED);
#else
// No atomic_ref or equivalent functionality available on this platform!
#error "Platform not supported!"
#endif
}

Expand Down Expand Up @@ -81,6 +82,7 @@ namespace crill {
__atomic_store_n(dest_bytes + i, src_bytes[i], __ATOMIC_RELAXED);
#else
// No atomic_ref or equivalent functionality available on this platform!
#error "Platform not supported!"
#endif
}

Expand Down
6 changes: 5 additions & 1 deletion include/crill/impl/progressive_backoff_wait_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
#if CRILL_INTEL
#include <emmintrin.h>
#elif CRILL_ARM_64BIT
#include <arm_acle.h>
#ifdef _WIN32
#include <intrin.h>
#else
#include <arm_acle.h>
#endif
#endif

namespace crill::impl
Expand Down
2 changes: 1 addition & 1 deletion include/crill/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define CRILL_ARM 1
#define CRILL_32BIT 1
#define CRILL_ARM_32BIT 1
#elif defined (__arm64__)
#elif defined (__arm64__) || defined (_M_ARM64)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we’re at it would be great to add support for Android with __aarch64__ as well (see docs).

Suggested change
#elif defined (__arm64__) || defined (_M_ARM64)
#elif defined (__arm64__) || defined (__aarch64__) || defined (_M_ARM64)

#define CRILL_ARM 1
#define CRILL_64BIT 1
#define CRILL_ARM_64BIT 1
Expand Down