Skip to content
Snippets Groups Projects
Commit 0e7c852b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa
Browse files

Merge branch 'jasnell-fix-compile-windows-arm64' into master

parents 6e02c26c 576f2d47
Branches
No related merge requests found
...@@ -244,6 +244,14 @@ static uint64_t ngtcp2_cbrt(uint64_t n) { ...@@ -244,6 +244,14 @@ static uint64_t ngtcp2_cbrt(uint64_t n) {
#if defined(_MSC_VER) #if defined(_MSC_VER)
# if defined(_M_X64) # if defined(_M_X64)
d = (int)__lzcnt64(n); d = (int)__lzcnt64(n);
# elif defined(_M_ARM64)
{
unsigned long index;
d = sizeof(uint64_t) * CHAR_BIT;
if (_BitScanReverse64(&index, n)) {
d = d - 1 - index;
}
}
# else # else
if ((n >> 32) != 0) { if ((n >> 32) != 0) {
d = __lzcnt((unsigned int)(n >> 32)); d = __lzcnt((unsigned int)(n >> 32));
......
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
#include "ngtcp2_macro.h" #include "ngtcp2_macro.h"
#if defined(_MSC_VER) && defined(_M_ARM64)
unsigned int __popcnt(unsigned int x) {
unsigned int c = 0;
for (; x; ++c) {
x &= x - 1;
}
return c;
}
#endif
int ngtcp2_ringbuf_init(ngtcp2_ringbuf *rb, size_t nmemb, size_t size, int ngtcp2_ringbuf_init(ngtcp2_ringbuf *rb, size_t nmemb, size_t size,
const ngtcp2_mem *mem) { const ngtcp2_mem *mem) {
#ifdef WIN32 #ifdef WIN32
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment