Wrox Programmer Forums
BOOK: Professional Assembly Language
This is the forum to discuss the Wrox book Professional Assembly Language by Richard Blum; ISBN: 9780764579011
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Assembly Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 23rd, 2012, 08:59 PM
Registered User
Join Date: Dec 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default i need some help!

i come across a question when i read the page 149-150 of the book.
the code source below:
if (eax < ebx) || (eax == ecx) creates the following assembly language code:
cmpl %eax, %ebx
jle else
cmpl %eax, %ecx
jne else
< then logic code>
jmp end
< else logic code >
This If statement condition required two separate CMP instructions. Because the logical operator is
an OR, if either CMP instruction evaluates to true, the program jumps to the else label. If the logical
operator is an AND, you would need to use an intermediate label to ensure that both CMP instructions
evaluate to true.
i think it should use if (eax < ebx) && (eax == ecx) instead of if (eax < ebx) || (eax == ecx)

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.