mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-08-29 23:32:07 +03:00
+9
-1
@@ -18,6 +18,14 @@ from .utils import (
|
||||
)
|
||||
|
||||
|
||||
def int_to_int32(n):
|
||||
"""Converts an integer to a signed 32-bit integer"""
|
||||
n &= 0xFFFFFFFF
|
||||
if n & 0x80000000:
|
||||
return n - 0x100000000
|
||||
return n
|
||||
|
||||
|
||||
def _js_bit_op(op):
|
||||
def zeroise(x):
|
||||
if x in (None, JS_Undefined):
|
||||
@@ -28,7 +36,7 @@ def _js_bit_op(op):
|
||||
return int(float(x))
|
||||
|
||||
def wrapped(a, b):
|
||||
return op(zeroise(a), zeroise(b)) & 0xffffffff
|
||||
return int_to_int32(op(int_to_int32(zeroise(a)), int_to_int32(zeroise(b))))
|
||||
|
||||
return wrapped
|
||||
|
||||
|
||||
Reference in New Issue
Block a user