Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- typedef void (*void_fct_void) (void);
- typedef void (*void_fct_int16) (int16);
- typedef void (*void_fct_int32) (int32);
- typedef void (*void_fct_2int32) (int32, int32);
- ...
- Uint32 address;
- Uint16 sizeIn;
- address = HW_Usb_Read_4Bytes();
- sizeIn = HW_Usb_Read_1Byte();
- switch(sizeIn) {
- case 0:
- ((void_fct_void) address)();
- break;
- case 2:
- ((void_fct_int16) address)(HW_Usb_Read_2Bytes());
- break;
- case 4:
- ((void_fct_int32) address)(HW_Usb_Read_4Bytes());
- break;
- case 8:
- ((void_fct_2int32) address)(HW_Usb_Read_4Bytes(), HW_Usb_Read_4Bytes());
- break;
- }
- Uint32 address;
- Uint16 sizeIn;
- address = HW_Usb_Read_4Bytes();
- sizeIn = HW_Usb_Read_1Byte();
- putNbytesOnCallStack(sizeIn); // magic function
- ((void_fct_void) address)();
- __asm {
- push sizeIn
- ; You can also call your fp using asm:
- call address
- ; But it's not very safe because your compiler may not
- ; have saved its registries before the call
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement