Thread: Using carry bits

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    4

    Using carry bits

    I am just wondering if C or C++ has a way to view the carry bit(assembly).

    Thank You,

    Wildman6801

  2. #2
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    You can determine the carry-bit of addition as follows (works for any C compiler):
    Code:
    unsigned int a, b, aplusb, carrybit;
    ...
    aplusb=a+b;
    carrybit=a>~b;
    hope this helps... /* why is this in boldface? */
    alex
    Last edited by alex; 02-13-2002 at 12:55 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SDLKey to ASCII without unicode support?
    By zacs7 in forum Game Programming
    Replies: 6
    Last Post: 10-07-2007, 03:03 AM
  2. Help counting number of bits set in an integer
    By JayDiddums10 in forum C Programming
    Replies: 5
    Last Post: 12-07-2006, 03:21 PM
  3. Help With Stacks
    By penance in forum C Programming
    Replies: 7
    Last Post: 10-09-2005, 02:47 PM
  4. Writing binary data to a file (bits).
    By OOPboredom in forum C Programming
    Replies: 2
    Last Post: 04-05-2004, 03:53 PM
  5. New idea on conveting byte to bits/bits to byte
    By megablue in forum C Programming
    Replies: 10
    Last Post: 10-26-2003, 01:16 AM