mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-15 05:48:08 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
bb46e1af8b
commit
305f4449b8
|
@ -14,9 +14,9 @@ All parameters must be must be int >= 0, referred to as a 'bit integer'.
|
||||||
|
|
||||||
index:int
|
index:int
|
||||||
The offset into the bit position from right,
|
The offset into the bit position from right,
|
||||||
0b010111 -> list [1,1,1,0,1,0]. big-endian -> little-endian
|
0b010111 -> list [1,1,1,0,1,0]. big-endian -> little-endian
|
||||||
For inserts, index is the position to the right of index,
|
For inserts, index is the position to the right of index,
|
||||||
index 0 -> right of rightmost bit.
|
index 0 -> right of rightmost bit.
|
||||||
For gets, sets and removes, it is the position of the bit itself.
|
For gets, sets and removes, it is the position of the bit itself.
|
||||||
|
|
||||||
value:int
|
value:int
|
||||||
|
@ -24,7 +24,7 @@ All parameters must be must be int >= 0, referred to as a 'bit integer'.
|
||||||
|
|
||||||
bitlen:int
|
bitlen:int
|
||||||
The effective mask length, spec. leading zeros
|
The effective mask length, spec. leading zeros
|
||||||
( bitlen 4 value 1 -> 0001 )
|
( bitlen 4 value 1 -> 0001 )
|
||||||
|
|
||||||
The bitwise expressions may look convoluted, but basically, there are
|
The bitwise expressions may look convoluted, but basically, there are
|
||||||
just three parts: left-hand side, value, right-hand side.
|
just three parts: left-hand side, value, right-hand side.
|
||||||
|
@ -59,7 +59,7 @@ and slicing, but this bitwise implementation is significantly faster
|
||||||
|
|
||||||
See https://github.com/billbreit/BitWiseApps/blob/main/dev/time_ops.py
|
See https://github.com/billbreit/BitWiseApps/blob/main/dev/time_ops.py
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
bit_length = int.bit_length
|
bit_length = int.bit_length
|
||||||
|
|
||||||
|
@ -230,7 +230,6 @@ def multibit_remove(bint: int, index: int, bit_len: int) -> int:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
import doctest
|
import doctest
|
||||||
|
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user