def by_indextype(self, index, dtype):
"""Lookup a register according to its `index` and `dtype`.
Some examples of dtypes: idaapi.dt_byte, idaapi.dt_word, idaapi.dt_dword, idaapi.dt_qword
"""
res = idaapi.ph.regnames[index]
name = self.__cache__[res, dtype]
return getattr(self.__register__, name)
def dt_to_width(self, dt):
'''
returns OOFW_xxx flag given a dt_xxx
'''
return {
idaapi.dt_byte: idaapi.OOFW_8,
idaapi.dt_word: idaapi.OOFW_16,
idaapi.dt_dword: idaapi.OOFW_32,
idaapi.dt_qword: idaapi.OOFW_64,
}[dt]