Skip to content

Commit dfe5989

Browse files
author
Joshua Thomas Przyborowski
authored
Update pycatfile.py
1 parent 53b2660 commit dfe5989

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pycatfile.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,22 @@ def crc64_iso(msg, initial_value=0xFFFFFFFFFFFFFFFF):
14121412
crc &= 0xFFFFFFFFFFFFFFFF # Ensure CRC remains 64-bit
14131413
return crc
14141414

1415+
def MajorMinorToDev(major, minor):
1416+
"""
1417+
Converts major and minor numbers to a device number.
1418+
Compatible with Python 2 and 3.
1419+
"""
1420+
return (major << 8) | minor
1421+
1422+
def DevToMajorMinor(dev):
1423+
"""
1424+
Extracts major and minor numbers from a device number.
1425+
Compatible with Python 2 and 3.
1426+
"""
1427+
major = (dev >> 8) & 0xFF
1428+
minor = dev & 0xFF
1429+
return major, minor
1430+
14151431

14161432
def GetDataFromArray(data, path, default=None):
14171433
element = data

0 commit comments

Comments
 (0)