Skip to content

Commit 9de95f4

Browse files
committed
deps: temporary fixup for ngtcp2 to build on windows
The ngtcp2 update uses a gcc builtin that is not available under _MSC_VER. This floats a patch to fix it. Upstream PR: ngtcp2/ngtcp2#247 PR-URL: #34033 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 86e67aa commit 9de95f4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

deps/ngtcp2/lib/ngtcp2_cc.c

+13
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@
3131
#include "ngtcp2_mem.h"
3232
#include "ngtcp2_rcvry.h"
3333

34+
#ifdef _MSC_VER
35+
#include <intrin.h>
36+
static inline int __builtin_clzll(unsigned long long x) {
37+
#if defined(_WIN64) || defined(_LP64)
38+
return (int)__lzcnt64(x);
39+
#else
40+
// TODO(@jasnell): Determine if there's an alternative available for x86
41+
assert(0);
42+
#endif
43+
44+
}
45+
#endif
46+
3447
uint64_t ngtcp2_cc_compute_initcwnd(size_t max_udp_payload_size) {
3548
uint64_t n = 2 * max_udp_payload_size;
3649
n = ngtcp2_max(n, 14720);

0 commit comments

Comments
 (0)