A 6 Byte Number Data Type

Thread: A 6 Byte Number Data Type

  1. A 6 Byte Number Data Type

    Chronom1 said:

    A 6 Byte Number Data Type

    Does C++ have a 6 byte Number Data Type??.
    I could not find one so I wrote my own class object for it
    floats are 4
    doubles are 8
    l
  2. Draco's Avatar

    Draco said:
    no, it doesnt. All it's got are chars, ints, floats, and longs.
  3. Salem's Avatar

    Salem said:
    Well depending on your compiler (which you don't mention), you could have
    long long int foo;
    __int64_t bar;
    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.
  4. skorman00's Avatar

    skorman00 said:
    I just posted on another thread about bitfields, which you might be able to use. You can build a struct that aligns a specific number of bits for a data type.

    Code: [View]
    struct Int36
    {
         int num : 36;
    };
    it might get a little cumbersome to use, but I'm sure it wouldn't be too much of a hassle.
  5. A 6 Byte Number Data Type

    bludstayne said:
    There are many ways you can accomplish it. You could do like skorman said with a little bit of inconvenience (and I mean little). I've used bitfields for embedded programming a lot. Worked like a charm for our robot controller.

    You could go with Salem's method, if you don't care about wasting a little bit of space, which I again, I emphasise little

    You could even make a C++ class and overload all the operators if you want to go all out
  6. A 6 Byte Number Data Type

    okinrus said:
    You can get this bahavior by using std::bitset
    Last edited by okinrus; 07-08-2004 at 05:34 PM.