here is some new test code with regards to my long issue. I figure that if i code my stuff as long long then that is half the battle in porting. the other half would be to make it into big endian so it can work on any 64 bit system. so i did the following:
#include <iostream>
#include "byteswap.h"
#include "stdlib.h"
using namespace std;
int main()
{
char bytes[6] = {0x12,0x23,0xff,0xed,0x22,0x34};
//long *p_long = reinterpret_cast<long*> (bytes);
long long *p_long = reinterpret_cast<long long*> (bytes);
std::cout<<"hex="<<std::hex<<*p_long<<"LE"<<std::endl;
*p_long = bswap_64(*p_long);
std::cout<<"hex="<<std::hex<<*p_long<<"BE"<<std::endl;
return 0;
}
this seems to me the simplest way of doing it. the problem now is at using bswap...i get the following output
hex=34563422edff2312LE hex=0BE
i got all the bytes in the first as LE. but now it seems the 64bit swap function is not working. I think this would solve the issue i am having.
considering that i will be operating on a 20 byte array. i am also not sure how i would use pointers to do that. i am thinking i would need an array of long long pointers to get all this stuff stored and then call the byteswap on each to swap the values in each of those pointers. I personally have not done pointer incrementation via sizeof(long) to increment before.