Jay Ts wrote:
On Wed, Nov 16, 2005 at 10:37:02PM -0500, Greg Sepesi wrote:

#include <stdio.h>
void main() {
  unsigned long b, t;
  unsigned short tmp;

  b = 5621;
  tmp = 14365;
  t = b + (tmp%100) * 10000L;
  b |= (tmp%100) * 10000L;

  printf(
     "t = %d\n"
     "b = %d\n",
     t, b);
}

output:
t = 655621
b = 655349

question:
Why are t and b not the same?


Check your arithmetic:

        t = 65000 + 5621 = 655621
        b = 65000 | 5621 = 655349

Jay Ts


Doh!  For some reason I was thinking of the numbers as hexadecimal.

Thanks,
Greg

--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to