On Thu, 26 Aug 1999, Kenichi Okuyama wrote:

> >>>>> "MD" == Mike Davis <[EMAIL PROTECTED]> writes:
> MD> How is this possible?  Why does the value for the Long (x) get
> MD> reset to zero?
> 
> Simple.
> 
> StrItoA() can't handle "long long", and you are treating values in
> big endian format. that's why values became 0.

This cannot possibly be the reason.  First, StrIToA is only used in the
FrmCustomAlert and in fact works.

Second, the problem exists and that is the reason for my question, EVEN
if I take out the StrIToA and FrmCustomAlert function.  They are only
there for debug, because I have the problem.  They ARE NOT the cause of
the problem.
 
> 
> StrItoA() can treat only variables of "Long" which is "long"
> actually, and is 32bits long( or 4 bytes long ).And this value is
> given as second parameter.

Again, StrIToA has nothing to do with the problem and the reason I asked
the question.  x is calculated properly in the function.  x is zero in
the calling function.  That is the problem.  

> On other hand, variable x, which is long long, uses 64bit long( or 8
> bytes long ).
> 
> Since Palm is big endian device, when you put 
>       0x123456789abcdef0ULL
> values to x, then image of byte array will become
>         +0 +1 +2 +3 +4 +5 +6 +7
>       12 34 56 78 9a bc de f0
> 
> If you analyze this byte array as if it is 32bit long fixed point
> values of big endian, what you'll get is
> 
>       0x12345678
> 
> latter "9abcdef0" parts being cut off.
> 
> 
> If you gave a value of very small number(I mean values below 4G),
> then you'll get 0 for this program. And since this value is second
> parameter, latter 4 bytes( I mean 9a bc de f0 part ) will do no harm
> against entire parameter. If it was of 1st parameter, then things
> will differ.

I might be confused but the simple fact is that from within my StrToLL
routine, the value of x is correct.  So the calculation of x is
performed properly.  I can check the value there and it is OK.  Only
when the value is passed back to the calling function is that value
lost.  That is the problem.

I just need to know why.  I guess I could just use a global variable and
not worry about passing the value back but I'd like to know why.  It
would seem that if LL are allowed then they could be passed as variables
in functions that use LL.

> 
> 
> regards,
> 
> 

----------------------------------------------------
Shoot-to-Win

Protect the 2nd Amendment
----------------------------------------------------

Reply via email to