不懂python,不过,一开头就是一堆库,这些都是系统自带么?
若是缺了其中任意一个,比如:dbf,那也白搭啊。
=============
from __future__ import absolute_import, division, print_function
import io
import sys
import os
import struct
from math import floor, log10
from datetime import datetime, timedelta
from collections import OrderedDict
import re
import errno
import dbf
=============
第一个函数,就是一堆的字节运算,这跟生啃汇编,有啥区别?
=============
def checksum_calc(string):
chunk = string[0]
chunka = (chunk & 0xF0) >> 4
chunkb = (chunk & 0x0F) >> 0
chunk = string[1]
chunkc = (chunk & 0xF0) >> 4
chunkd = (chunk & 0x0F) >> 0
for chunk in string:
chunka ^= (chunk & 0xF0) >> 4
chunkb ^= (chunk & 0x0F) >> 0
chunk = (chunka << 9) + ((chunka ^ chunkb) << 5)
chunka, chunkb, chunkc, chunkd = (
chunka ^ chunkb ^ chunkc ^ ((chunk & 0xF000) >> 12),
chunkd ^ ((chunk & 0x0F00) >> 8),
chunka ^ ((chunk & 0x00F0) >> 4),
chunka ^ chunkb ^ ((chunk & 0x000F) >> 0),
)
return (chunka << 12) + (chunkb << 8) + (chunkc << 4) + (chunkd << 0)
=============
这是要将fxp,还原为prg?