Commit a10e286a authored by Zhukov, Alexander P's avatar Zhukov, Alexander P
Browse files

Py optimization

parent 68470d00
......@@ -41,7 +41,7 @@ def tst(file,rec):
rec['timestamp']=t
return True
def i32(file,rec,param=False,wf=False):
def param_value(file,rec,param=False,wf=False, vtype='I'):
if param:
key = short_str(file)
else:
......@@ -49,32 +49,36 @@ def i32(file,rec,param=False,wf=False):
if wf:
length = read_size(file)
raw = file.read(length)
ar = array('I',raw)
ar = array(vtype,raw)
ar.byteswap()
value = ar
else:
raw = file.read(4)
ar = array('I',raw)
ar = array(vtype,raw)
ar.byteswap()
value = ar[0]
rec[key]=value
if param:
pdict = rec.get('parameters',{})
pdict[key]=value
rec['parameters'] = pdict
else:
rec[key]=value
def i32val(file, rec):
i32(file,rec, False, False)
param_value(file,rec, False, False,'I')
return True
def i32par(file, rec):
i32(file, rec, True, False)
param_value(file, rec, True, False,'I')
return True
def i32wfval(file, rec):
i32(file,rec, False, True)
param_value(file,rec, False, True,'I')
return True
def i32wfpar(file, rec):
i32(file, rec, True, True)
param_value(file, rec, True, True,'I')
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment