Sender: nate AT cartsys DOT com Message-ID: <36634667.C344DF85@cartsys.com> Date: Mon, 30 Nov 1998 17:29:11 -0800 From: Nate Eldredge X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: misc questions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Tal Lavi wrote: > > Just a couple of misc questions, thanks in advance: > > 1)Can I define an extended asm command as a macro, > with one of the outputs value returned? You can, using GCC's statement-expressions extension. Example: #define TEST_BIT(n, b) ({ \ char c; \ asm("btl %1, %2; " \ "setcb %0" \ : "=rm" (c) \ : "rI" (b), "rm" (n)); \ c; \ }) See also the info nodes "Statement Exprs" and "Extended Asm" in the GCC docs. > 2)I need to access a word size union in two forms: as the entire 16-bit word, > and as the first 5 bits, next 6 and last 5. > Can this be done in DJGPP? You can try: union word { unsigned short s; struct { unsigned low : 5; unsigned mid : 6; unsigned high : 5; } bits; }; I'm not sure what order GCC allocates bitfields in, so that might be wrong. You can also do some macros with shifting and masking; that will also be more portable. -- Nate Eldredge nate AT cartsys DOT com