Skip to content

Commit 3f60960

Browse files
addaleaxMylesBorins
authored andcommitted
http2: simplify onSelectPadding
`OnCallbackPadding` on the native side already clamps the return value into the right range, so there’s not need to also do that on the JS side. Also, use `>>> 0` instead of `| 0` to get an uint32, since the communication with C++ land happens through an Uint32Array. PR-URL: #17717 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e7a99b3 commit 3f60960

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

lib/internal/http2/core.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,7 @@ function onSelectPadding(fn) {
353353
return function getPadding() {
354354
const frameLen = paddingBuffer[PADDING_BUF_FRAME_LENGTH];
355355
const maxFramePayloadLen = paddingBuffer[PADDING_BUF_MAX_PAYLOAD_LENGTH];
356-
paddingBuffer[PADDING_BUF_RETURN_VALUE] =
357-
Math.min(maxFramePayloadLen,
358-
Math.max(frameLen,
359-
fn(frameLen,
360-
maxFramePayloadLen) | 0));
356+
paddingBuffer[PADDING_BUF_RETURN_VALUE] = fn(frameLen, maxFramePayloadLen);
361357
};
362358
}
363359

0 commit comments

Comments
 (0)