lundi 15 octobre 2018

For signed number , we use ja not jg

void switch_eq(long x, long n, long *dest){
 long val = x;
 switch(n) {

  case 100:
  .
  .
  .
 }

In the text book, they suggested it is equivalent assembly code

switch_eg:

 subq $100, %rsi
 cmpq $6,  %rsi
 ja  .L8
 .
 .
 .

I think we'd better to use jg not ja since, I think, $6 and %rsi are signed number Am i wrong?

Aucun commentaire:

Enregistrer un commentaire