From 9de95f494e25f3ba8100c54e6263736c2bfe48f0 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 23 Jun 2020 14:58:48 -0700 Subject: [PATCH] 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: https://github.com/ngtcp2/ngtcp2/pull/247 PR-URL: https://github.com/nodejs/node/pull/34033 Reviewed-By: Anna Henningsen Reviewed-By: Jiawen Geng Reviewed-By: Daniel Bevenius --- deps/ngtcp2/lib/ngtcp2_cc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/deps/ngtcp2/lib/ngtcp2_cc.c b/deps/ngtcp2/lib/ngtcp2_cc.c index 9c61a5e9564519..3aed4dd759dd90 100644 --- a/deps/ngtcp2/lib/ngtcp2_cc.c +++ b/deps/ngtcp2/lib/ngtcp2_cc.c @@ -31,6 +31,19 @@ #include "ngtcp2_mem.h" #include "ngtcp2_rcvry.h" +#ifdef _MSC_VER +#include +static inline int __builtin_clzll(unsigned long long x) { +#if defined(_WIN64) || defined(_LP64) + return (int)__lzcnt64(x); +#else + // TODO(@jasnell): Determine if there's an alternative available for x86 + assert(0); +#endif + +} +#endif + uint64_t ngtcp2_cc_compute_initcwnd(size_t max_udp_payload_size) { uint64_t n = 2 * max_udp_payload_size; n = ngtcp2_max(n, 14720);