Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #13738

Re: Changing type at runtime for image acquisition

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Changing type at runtime for image acquisition
Date 2011-11-21 16:04 -0500
Organization A noiseless patient Spider
Message-ID <4ECABCD4.5090508@verizon.net> (permalink)
References <KMxyq.101324$GZ3.69880@tornado.fastwebnet.it> <4ECAAE78.7050304@verizon.net> <nzyyq.101345$GZ3.64187@tornado.fastwebnet.it>

Show all headers | View raw


On 11/21/2011 03:32 PM, Davide wrote:
> James Kuyper wrote:
> 
> <snip>
>> You could use void* to store the pointer to the buffer, and convert to
>> __int8 or __int16 as needed:
>>
>>      if(eight_bit)
>>          n = ((__int8*)internal_buffer)[j];
>>      else
>>          n = ((__int16*)internal_buffer)[j];
...
> Thank you very much. I understood your second approach with a union,
> but i have some doubts about the first one. What type should 'n' be?

It could be __int16, but int_fast16_t is more precisely what I'd want to
use. However, I'd normally translate 'int_fast16_t' to 'int', simply
because it's easier to type, unless speed is very important.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Changing type at runtime for image acquisition Davide <idontwant@emailsfrom.spammers> - 2011-11-21 20:38 +0100
  Re: Changing type at runtime for image acquisition James Kuyper <jameskuyper@verizon.net> - 2011-11-21 15:03 -0500
    Re: Changing type at runtime for image acquisition Davide <idontwant@emailsfrom.spammers> - 2011-11-21 21:32 +0100
      Re: Changing type at runtime for image acquisition James Kuyper <jameskuyper@verizon.net> - 2011-11-21 15:42 -0500
      Re: Changing type at runtime for image acquisition James Kuyper <jameskuyper@verizon.net> - 2011-11-21 16:04 -0500
  Re: Changing type at runtime for image acquisition Kaz Kylheku <kaz@kylheku.com> - 2011-11-21 20:48 +0000
  Re: Changing type at runtime for image acquisition "BartC" <bc@freeuk.com> - 2011-11-21 21:34 +0000

csiph-web