binaryninja-api
binaryninja-api copied to clipboard
Implement wrappers around the Architecture ID types
Instead of using naked ids (u32) for types like: Register, Flag, Intrinsic, etc. This PR replaces those types with wrappers like: RegisterId, FlagId, IntrinsicId, etc.
The objective is to provide a more clear API for the user, once the type RegisterId can't be confused with any other u32.
This pattern also allow the creation of the ArchitectureExt::get_field that can receive any kind of id an return the corresponding type, eg:
let reg_id = get_reg_id();
let flag_id = get_flag_id();
let instrinsic_id = get_intrinsic_id();
let reg: CoreRegister = arch.get_field(reg_id).unwrap();
let flag: CoreFlag = arch.get_field(flag_id).unwrap();
let intrinsic: CoreIntrinsic = arch.get_field(instrinsic_id).unwrap();