Welcome, Guest. Please login or register.

Author Topic: a favor? run this program on a 68K based machine?  (Read 1631 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline pkivolowitzTopic starter

a favor? run this program on a 68K based machine?
« on: January 08, 2023, 03:34:28 AM »
Hi All,
Could someone compile and run the attached C++ program on a 68K family machine and send me the output?
I want to confirm the correct operation of the program that dumps integers looking at endianness.
Thank you

--- snip ---


/*  Determine Endianness
    Perry Kivolowitz
    Carthage College
*/

#include <iostream>
#include <iomanip>
#include <sstream>
#include <cinttypes>
#include <string>

using namespace std;

template <class T>
string Dump(T & i) {
    stringstream ss;
    unsigned char * p = reinterpret_cast<unsigned char *>(&i);

    ss << hex << setfill('0');
    for (uint32_t counter = 0; counter < sizeof(T); counter++) {
        ss << setw(2) << static_cast<int>(*(p++));
    }
    return ss.str();
}

int main() {
    int16_t i16 = 0x0123;
    int32_t i32 = 0x01234567;
    int64_t i64 = 0x0123456789ABCDEF;

    cout << hex << setfill('0');
    cout << "Endianness of this computer:\n";
    cout << "i16: " << setw(16) << Dump(i16) << " value: " << setw(16) << i16 << endl;
    cout << "i32: " << setw(16) << Dump(i32) << " value: " << setw(16) << i32 << endl;
    cout << "i64: " << setw(16) << Dump(i64) << " value: " << setw(16) << i64 << endl;
    cout << "If little endian, column 1 will not equal column 2.\n";
    return 0;
}


 

Offline pkivolowitzTopic starter

Re: a favor? run this program on a 68K based machine?
« Reply #1 on: January 10, 2023, 02:06:02 AM »
No replies? Is there a more active place I can try?

And I love the "newbie" flare given to me. Member here since 2010 and an Amiga person since 1985.
 
The following users thanked this post: klx300r

Offline Tygre

Re: a favor? run this program on a 68K based machine?
« Reply #2 on: January 10, 2023, 02:33:20 AM »
Hi pkivolowitz!

Maybe try over on EAB? :)

I'd help but I don't have a C++ compiler installed right now (I'm using VBCC).

Cheers!

Offline klx300r

  • Amiga 1000+AmigaOne X1000
  • Hero Member
  • *****
  • Join Date: Sep 2007
  • Posts: 3244
  • Country: ca
  • Thanked: 20 times
  • Gender: Male
    • Show only replies by klx300r
    • http://mancave-ramblings.blogspot.ca/
Re: a favor? run this program on a 68K based machine?
« Reply #3 on: January 11, 2023, 08:30:19 PM »
hmm endianness eh ;) been a while since I had compiler on my miggy but I can post this for you over at amigans or EAB (if you don't have accounts there)as there's more than a few developers that can help you out..either way good luck :)
____________________________________________________________________
c64-dual sids, A1000, A1200-060@50, A4000-CSMKIII
Indivision AGA & Catweasel MK4+= Amazing
! My Master Miggies-Amiga 1000 & AmigaOne X1000 !
--- www.mancave-ramblings.blogspot.ca ---
  -AspireOS.com & Amikit- Amiga for your netbook-
***X1000- I BELIEVE *** :angel: