P-Code Instructions (pcode.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Cmpu<t>
                                              Up Contents Index Back
──P-Code Instructions───────────────────────────────────────────────────────
 
  Syntax
 
  Cmpu<t>
 
  /* Compare top two items on stack as unsigned values */
 
  Possible Instructions
 
  CmpuL, CmpuW
 
  See: P-Code Data Types
 
  Description
 
  Pops two elements from the stack and performs an unsigned compare on
  them. Depending on the results of the compare, a -1, 0, or 1 is pushed
  onto the stack, followed by a 0.
 
  These results can be then compared by the normal (signed) compares.
  Cmpu<t>, JgtW<n> is thus equivalent to an unsigned JgtW<n>.
 
  Pseudocode equivalent:
 
  unsigned u<t>1, u<t>2;
  u<t>2 = Pop<t>();
  u<t>1 = Pop<t>();
  Push(u<t>1 == u<t>2 ? 0 : (u<t>1 > u<t>2) ? 1 : -1);
  Push(0);
 
  The following example is one that generates this instruction:
 
  uTest1 = 99;
  uTest2 = 100;
  uTest1 = (uTest1 * uTest2 <10000 ? 0 : 1);
  /* generates CmpuW */
 
 
                                     -♦-