delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/31/09:17:41

Message-Id: <m0z2F0C-000S3uC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "Johan Henriksson" <johan DOT henriksson AT borlange DOT mail DOT telia DOT com>,
djgpp AT delorie DOT com
Date: Fri, 31 Jul 1998 10:23:43 +0000
MIME-Version: 1.0
Subject: Re: short int and unsigned char
In-reply-to: <199807302138.XAA10684@d1o22.telia.com>

"Johan Henriksson" <johan DOT henriksson AT borlange DOT mail DOT telia DOT com> wrote:

> I wonder how big a short int is (in bits) 

DJGPP: 16.

> and if there are anything smaller then an unsigned char (1, 2, 4 bits).

No and yes. You can use bitfields to break an integer in bits. The result is 
similar to an structure but inside a variable.

>  I also wonder if there is any command
> to read and write a single bit in a variable.

You can use bitfields again or bit masks:

if (a & 0x80) ....
means: bit 7 of a is != 0 (b7 counting from b0).

SET
------------------------------------ 0 --------------------------------
Visit my home page: http://set-soft.home.ml.org/
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019