The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: V Coder on March 23, 2006, 06:11:07 AM

Title: Reverse a base 100 number
Post by: V Coder on March 23, 2006, 06:11:07 AM
Hi, what's the quickest way to reverse a 100 number? Max value 99.

(x%10)*10 + (x\10)

Can we do this in parallel (SIMD)? Is there a better equation? Thanks.
Title: Re: Reverse a base 100 number
Post by: EduardoS on March 23, 2006, 10:54:01 AM
Try AAM, AAD and xchg (with value in AL and result in AL):

AAM
XCHG AL, AH
AAD
Title: Re: Reverse a base 100 number
Post by: Eóin on March 23, 2006, 01:25:28 PM
What do you mean by base 100, and reverse. Can you give an example.

I ask because a base 100 number with a max value of 99 is actually a single digit number.