From: ranger3 AT m-net DOT arbornet DOT org Newsgroups: comp.os.msdos.djgpp Subject: Re: typedef'ing a 24-bit integer Date: Tue, 01 Jun 1999 03:18:33 GMT Organization: Deja.com - Share what you know. Learn what you don't. Lines: 34 Message-ID: <7ivjea$s5s$1@nnrp1.deja.com> References: <37459ABF DOT FF51CA41 AT aaual DOT ualg DOT pt> <374601DE DOT 630CEA74 AT cartsys DOT com> <3746C21F DOT 201AF26D AT user DOT rose DOT com> NNTP-Posting-Host: 164.164.6.31 X-Article-Creation-Date: Tue Jun 01 03:18:33 1999 GMT X-Http-User-Agent: Mozilla/4.51 [en] (Win95; I) X-Http-Proxy: 1.0 Diamond AT wipinfo DOT soft DOT net:8080 (Squid/2.2.PRE2), 1.0 x29.deja.com:80 (Squid/1.1.22) for client 192.168.225.97, 164.164.6.31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <3746C21F DOT 201AF26D AT user DOT rose DOT com>, djgpp AT delorie DOT com wrote: > Nate Eldredge wrote: > > > Miguel Guerreiro wrote: > > > > > > How can you do somethin kinda like this: > > > > > > typedef int24 (24-bit integer) > > > typedef uint24 (24-bit unsigned int) > > > > > > I want it to take *exactly* 24-bit of space > > > > You can't. > > Couldn't he create a struct with a 24-bit bit field? It would still > take 32 bits of space but would manipulate as 24 bits (I think). You can do something like : typedef struct s { unsigned int : 24 } __attribute__((packed)) uint24 ; under gcc and #pragma(1) under msoft c++ to get a packed 24 bit structure. The signed follows from above. Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.