05 more about conditionals 09 49 tủ tài liệu bách khoa

10 34 0
05 more about conditionals 09 49 tủ tài liệu bách khoa

Đang tải... (xem toàn văn)

Thông tin tài liệu

University  of  Washington   Condi3onal  Branch  Example   int absdiff(int x, int y) { int result; if (x > y) { result = x-y; } else { result = y-x; } return result; } absdiff: pushl movl movl movl cmpl jle subl movl L8: leave ret L7: subl jmp x86   %ebp %esp, %ebp 8(%ebp), %edx 12(%ebp), %eax %eax, %edx L7 %eax, %edx %edx, %eax Setup   Body1   Finish   %edx, %eax L8 Body2   University  of  Washington   Condi3onal  Branch  Example  (Cont.)   int goto_ad(int x, int y) { int result; if (x y) { result = x-y; } else { result = y-x; } return result; } ¢  ¢  x86   C  allows  “goto”  as  means  of   transferring  control   §  Closer  to  machine-­‐level   programming  style   Generally  considered  bad  coding   style   University  of  Washington   Condi3onal  Branch  Example  (Cont.)   absdiff: pushl movl movl movl cmpl jle subl movl L8: leave ret L7: subl jmp int goto_ad(int x, int y) { int result; if (x

Ngày đăng: 09/11/2019, 06:39

Tài liệu cùng người dùng

Tài liệu liên quan