2025-12-25 upload
This commit is contained in:
13
venv/Lib/site-packages/mitmproxy/utils/bits.py
Normal file
13
venv/Lib/site-packages/mitmproxy/utils/bits.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def setbit(byte, offset, value):
|
||||
"""
|
||||
Set a bit in a byte to 1 if value is truthy, 0 if not.
|
||||
"""
|
||||
if value:
|
||||
return byte | (1 << offset)
|
||||
else:
|
||||
return byte & ~(1 << offset)
|
||||
|
||||
|
||||
def getbit(byte, offset):
|
||||
mask = 1 << offset
|
||||
return bool(byte & mask)
|
||||
Reference in New Issue
Block a user