Mercurial > hgrepos > Python > apps > py-cutils
comparison shasum.py @ 57:0fa2067bedb8
Common initialization is now common when computing the hashes from a mmap
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Tue, 08 Feb 2022 17:13:15 +0100 |
| parents | 6e91c530545f |
| children | ae5b31c10b41 |
comparison
equal
deleted
inserted
replaced
| 56:6e91c530545f | 57:0fa2067bedb8 |
|---|---|
| 482 h.update(buf) | 482 h.update(buf) |
| 483 else: | 483 else: |
| 484 # mmap | 484 # mmap |
| 485 if filesize < MAP_CHUNK_SIZE: | 485 if filesize < MAP_CHUNK_SIZE: |
| 486 mapsize = filesize | 486 mapsize = filesize |
| 487 mapoffset = 0 | |
| 488 else: | 487 else: |
| 489 mapsize = MAP_CHUNK_SIZE | 488 mapsize = MAP_CHUNK_SIZE |
| 490 mapoffset = 0 | 489 mapoffset = 0 |
| 491 rest = filesize | 490 rest = filesize |
| 492 while rest > 0: | 491 while rest > 0: |
| 493 m = mmap.mmap(fd, | 492 m = mmap.mmap(fd, |
| 494 mapsize, | 493 mapsize, |
| 495 access=mmap.ACCESS_READ, | 494 access=mmap.ACCESS_READ, |
