Skip to content

Commit

Permalink
deps: temporary fixup for ngtcp2 to build on windows
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jasnell committed Jun 24, 2020
1 parent 86e67aa commit 9de95f4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions deps/ngtcp2/lib/ngtcp2_cc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@
#include "ngtcp2_mem.h"
#include "ngtcp2_rcvry.h"

#ifdef _MSC_VER
#include <intrin.h>
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);
Expand Down

0 comments on commit 9de95f4

Please sign in to comment.