[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Time-efficient read of high byte in two-byte variable

From: E. Weddington
Subject: Re: [avr-gcc-list] Time-efficient read of high byte in two-byte variable
Date: Thu, 08 May 2003 17:37:10 -0600

On 8 May 2003 at 16:30, Wallace White wrote:

> E. Weddington wrote:
> >>Let's see, my variable in question is a signed int... so I could
> >>change the typedef union
> >>
> >> typedef union
> >> {
> >>  int16_t word;
> >>  hilow_t byte;
> >> } mytype ;
> >>
> >>and tack on .word to all my references to that variable... that
> >>should be fine, right?
> >>
> >>Thanks,
> >>Wallace
> > 
> > Hmm. Well it's up to you as to how you want to handle the signed
> > issue. Do you want the high byte to be signed? or unsigned? Do you
> > want the low byte to be signed as well?
> I don't really care which byte carries the sign... I'd just like to be
> able to use the variable as a regular signed int in the rest of the
> program--where it is used in math functions--while efficiently
> accessing its high byte during the function that spits the variable
> out the UART.

Oh, well, then you should be just fine with that solution.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]