From: vcarlos35 AT juno DOT com To: djgpp AT delorie DOT com Date: Mon, 1 Feb 1999 16:33:51 EST Subject: Re: can i do bit rotation in C? Message-ID: <19990201.163628.5863.0.vcarlos35@juno.com> References: X-Mailer: Juno 1.49 X-Juno-Line-Breaks: 0-11 Reply-To: djgpp AT delorie DOT com > one thing i want to do is rotate a char value's bits, like > the x86 assembly instruction ROR/ROL does. > is this possible with an operator, or do i have to use inline > assembly for that? > #define ROL(a,b) ((a) << (b) | (a) >> (8-(b))) #define ROR(a,b) ((a) >> (b) | (a) << (8-(b))) I'm almost certain that gcc is smart enough to generate the rotate opcode for this. ___________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com/getjuno.html or call Juno at (800) 654-JUNO [654-5866]