C code for this ARM code -


hi can me c code arm code:

('...' means further instructions)

adr r1, table  cmp r0, #tablemax  ldrls pc, [r1,r0,lsl #2]  ... ; statementsd  b exit  table dcd l0  dcd l1  ...  dcd ln  l0 ... ; statements0  b exit  l1 ... ; statements1  b exit  ...  ln ... ; statementsn  exit ... 

this switch statement in original c code, like:

switch (a) { case 0:      ... // statements 0 break; case 1:     ... // statements 1 break; ... case table_max /* (maybe table_max -1) */ :     ...  // statements n break; default:     ...  // statements d break; 

}

where = r0.

more recent versions of arm architecture in thumb-2 isa include 'table branch' instructions tbb, tbh code size reductions of particular case.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -