Problem in calculating checksum : casting int to signed int32

后端 未结 1 767
日久生厌
日久生厌 2021-01-14 08:53

I need to convert the following c code (to calculate checksum for a file) to python. I had written, the corresponding code in python but the result didn\'t match the c versi

相关标签:
1条回答
  • 2021-01-14 09:26

    Use numpy.int32 or numpy.uint32 if you need to restrict the range. Or mod it by 1 << 32 after operations that could "overflow".

    0 讨论(0)
提交回复
热议问题