Thread: Loading a bitmap

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > But that doesn't work for 64-bit machines - many 64-bit systems have a int that is 32-bit,
    > and a long that is 64-bit. Or both being 32-bit.
    But is that more for transitional reasons to prevent breakage of existing code, and still claim "64-bit" on the box?

    Though with only 2 widths to play with (16 or 32), int had to be the same as either short or long. But with 16/32/64, the compiler writers now have the freedom to make distinct choices.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    > But that doesn't work for 64-bit machines - many 64-bit systems have a int that is 32-bit,
    > and a long that is 64-bit. Or both being 32-bit.
    But is that more for transitional reasons to prevent breakage of existing code, and still claim "64-bit" on the box?
    Not really. It's practical to have a basic integer type that takes "several million" as a count. If you want MUCH more than that, you have 64-bit "long" numbers. Obviously, choosing a 32-bit long would be a matter of "make the least amount of changes to the current software" approach. But a 32-bit "int" is perfectly adequate for almost any software. How often do you use "long long" or "__int64" [as appropriate] in your code?

    Though with only 2 widths to play with (16 or 32), int had to be the same as either short or long. But with 16/32/64, the compiler writers now have the freedom to make distinct choices.
    Exactly, a 32-bit int is "big enough for most things". It takes half the space of a 64-bit integer, and whilst RAM-space may not matter much when you have many gigabytes, it's still important to keep the caches filled with useful stuff, and if the upper 32 bits are always filled with either all ones or all zeros, it's a bit of a waste to stuff this in the cache - and caches, even the largest ones, is still only up to a few gigabytes.

    Edit: Aside from fixing a broken quote tag, I would like to add that Windows and Linux have taken a different approach to the above choices:
    In windows, a long is 32 bits. In Linux, a long is 64 bits.

    --
    Mats
    Last edited by matsp; 11-05-2007 at 07:25 AM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading a bitmap (Without using glaux)
    By Shamino in forum Game Programming
    Replies: 7
    Last Post: 03-16-2006, 09:43 AM
  2. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 04:04 PM
  3. Loading a Bitmap resource for OpenGL Texture[x]
    By the dead tree in forum Game Programming
    Replies: 4
    Last Post: 08-26-2004, 01:12 PM
  4. Loading bitmap in dll
    By Mithoric in forum Windows Programming
    Replies: 2
    Last Post: 12-22-2003, 01:53 PM
  5. No one can seem to help me, loading bitmap
    By Shadow12345 in forum C++ Programming
    Replies: 7
    Last Post: 12-28-2002, 01:22 PM