Re: at2 swap_nibbles
Richard Braakman <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <20021125161606.GA3484@night> |
On Mon, Nov 25, 2002 at 05:46:51PM +0200, Oded Arbel wrote: > i don't think its related to anything. > the char type is a byte sized data storage, and the signed/unsigned behaviour is only important when casting to different types. It matters because of this: return ( ( byte & 15 ) * 10 ) + ( byte >> 4 ); The >> operator is allowed to sign-extend its operand, so that -16 (0xf0h) becomes -1 (0xffh). It won't do this if chars are unsigned, in which case 0xf0h just becomes 0x0fh. Richard Braakman