Skip to content

Commit a38941c

Browse files
addaleaxjasnell
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 e0e6b68 commit a38941c

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
@@ -413,11 +413,7 @@ function onSelectPadding(fn) {
413413
return function getPadding() {
414414
const frameLen = paddingBuffer[PADDING_BUF_FRAME_LENGTH];
415415
const maxFramePayloadLen = paddingBuffer[PADDING_BUF_MAX_PAYLOAD_LENGTH];
416-
paddingBuffer[PADDING_BUF_RETURN_VALUE] =
417-
Math.min(maxFramePayloadLen,
418-
Math.max(frameLen,
419-
fn(frameLen,
420-
maxFramePayloadLen) | 0));
416+
paddingBuffer[PADDING_BUF_RETURN_VALUE] = fn(frameLen, maxFramePayloadLen);
421417
};
422418
}
423419

0 commit comments

Comments
 (0)