From: "Florent" Newsgroups: comp.os.msdos.djgpp Subject: Re: twin complement ...... Date: Thu, 17 Aug 2000 20:17:31 +0200 Organization: Aachen University of Technology (RWTH) Lines: 39 Message-ID: <8nha67$m6k$1@nets3.rz.RWTH-Aachen.DE> References: <8ngqu9$fl8$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> NNTP-Posting-Host: pupulse.oih.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 966536199 22740 137.226.149.42 (17 Aug 2000 18:16:39 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 17 Aug 2000 18:16:39 GMT X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com the complement of 0x10 is 0xF0 of course ....... sorry I wrote 16 which is the decimal value ..... :o( the pb is when I do : int x=0x10 x=~x+1; we found x=xFFF0, and that's not what I would like to get (0xF0), the pb is that the non operation booleen transform all bits of the value and if this value can be coded with less bits, we get an error. I'm thinking of doing several operation , depends of how many bits the value is coded, but it's going to be a big functions. my question was if there any functions for doing it ??? Florent a écrit dans le message <8ngqu9$fl8$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>... >Hi, > >Is there any fonctions for the twin complement ? > >For example with 10 (in hexa) the twin complement is 16 but when I tried to >get it in my computer with >(~value)+1 >... it's completly wrong because the programme do the "non" booleen >operation on all the bits > >I will have to make it myself or there is a fonction for it ? > >thank you for your help, > >Florent. > >