From 5ea64e16583007eb977ba3d6046d9cb442a6cae1 Mon Sep 17 00:00:00 2001 From: soypat Date: Mon, 7 Sep 2026 07:42:03 -0700 Subject: [PATCH] omitting use of min saves 8 bytes --- tcp/handler.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tcp/handler.go b/tcp/handler.go index b435a64..b6cc5a5 100644 --- a/tcp/handler.go +++ b/tcp/handler.go @@ -677,10 +677,14 @@ func (h *Handler) putSynOptions(b []byte, mss uint16, isSynack bool) uint8 { // wireWnd converts a segment's real window to its on-wire representation. // SYN segments are never scaled (RFC7323 ยง2.2), we cap SYN windows at maxuint16. func (h *Handler) wireWnd(seg Segment) Size { + wnd := seg.WND if h.peerOfferedWS && !seg.Flags.HasAny(FlagSYN) { - return seg.WND >> h.wndShiftLocal + wnd >>= h.wndShiftLocal } - return min(seg.WND, 0xFFFF) + if wnd > 0xFFFF { + wnd = 0xFFFF + } + return wnd } // AwaitingSynResponse returns true if the Handler is an active client opened with [Handler.OpenActive] and has already sent out the first SYN packet to the remote client.