|
From: | Wallace White |
Subject: | Re: [avr-gcc-list] Time-efficient read of high byte in two-byte variable |
Date: | Thu, 08 May 2003 16:30:44 -0700 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425 |
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, WallaceHmm. 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.
The efficiency isn't critical for this application, really, so I may just keep doing it the way I had been. But thanks, Eric and Ralph, for the suggestions.
- Wallace
[Prev in Thread] | Current Thread | [Next in Thread] |