Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/util/crc32.py @ 258:57057028f13e
FIX: description for overflow error
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 16 Feb 2025 09:46:21 +0100 |
| parents | d852559df523 |
| children | b24080e5ca96 |
comparison
equal
deleted
inserted
replaced
| 257:1181d8cb4846 | 258:57057028f13e |
|---|---|
| 82 | 82 |
| 83 @staticmethod | 83 @staticmethod |
| 84 def as_uint32(i): | 84 def as_uint32(i): |
| 85 if i < 0: | 85 if i < 0: |
| 86 if i < -2147483648: | 86 if i < -2147483648: |
| 87 raise OverflowError("") | 87 raise OverflowError("invalid number for a 32-bit CRC") |
| 88 return (~i ^ 0xFFFFFFFF) | 88 return (~i ^ 0xFFFFFFFF) |
| 89 else: | 89 else: |
| 90 return i | 90 return i |
