Thread: Converting Integers to Binary

  1. #16
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I was just wondering if you've seen examples where a CHAR_BIT wasn't 8.
    Analog SHARC - CHAR_BIT == 32
    DSP 56156 Motorola - CHAR_BIT = 32
    DSP Texas - CHAR_BIT = 16

    Just a few.

    -Prelude
    My best code is written with the delete key.

  2. #17
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    Cool. I'll keep that in mind.
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

  3. #18
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    So Dave and Prelude,
    Are you saying that on a machine where CHAR_BIT is 16:

    If an int is 16 bits, sizeof(int) returns 1?
    If an int is 32 bits, sizeof(int) returns 2?

  4. #19
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by swoopy
    So Dave and Prelude,
    Are you saying that on a machine where CHAR_BIT is 16:

    If an int is 16 bits, sizeof(int) returns 1?
    If an int is 32 bits, sizeof(int) returns 2?
    yes. sizeof() returns size in chars, however big a char may be.
    hello, internet!

  5. #20
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    Originally posted by moi
    yes. sizeof() returns size in chars, however big a char may be.
    And what you wanna bet each memory location on such a machine is also 16 bits wide.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting 32 bit binary IP to decimal IP (vice-versa)
    By Mankthetank19 in forum C Programming
    Replies: 15
    Last Post: 12-28-2009, 07:17 PM
  2. Converting From Binary Tree to Threaded Binary Trees
    By elton_fan in forum C Programming
    Replies: 15
    Last Post: 11-08-2007, 11:41 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Converting Sign Magnitude Integer Binary Files
    By Arthur Dent in forum C Programming
    Replies: 7
    Last Post: 09-13-2004, 10:07 AM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM