M
ma740988
Consider:
# include <iostream>
# include <string>
# include <map>
# include <bitset>
# include <vector>
using namespace std;
typedef unsigned char* ADDR_TYPE;
typedef unsigned int uint_type;
uint_type const NUM_PROC(4);
int CNum2(2);
// Go back to Josuttis and see if I got the right candidate for teh Job
// for now a vector of pairs ...
typedef std:
air < unsigned int, std::vector<int> > Mypair;
typedef std::vector< Mypair > myVecPair;
void card2_func( myVecPair& refVec ) // give this function the array
{
int mask(0x10);
if (refVec.size())
{
refVec.clear();
}
uint_type SZ(NUM_PROC * CNum2);
int size(5);
for (int idx(0); idx < 2; ++idx)
{
uint_type lMask = 0x00000001 << (NUM_PROC*(CNum2-1));
uint_type nContor(NUM_PROC * (CNum2 - 1));
bool found_match(false);
for (; nContor < SZ; nContor++)
{
if (mask & lMask)
{
int val = mask & lMask;
refVec[idx].second.push_back(nContor);
printf(" %d\n", nContor);
found_match = true;
}
lMask <<= 1;
}
mask += 0x1;
if ( found_match )
{
refVec[idx].first = size;
}
size += 1;
// cout << " OK " << std::endl;
}
}
int main()
{
myVecPair mV;
card2_func(mV);
for (int idx(0); idx < mV.size(); ++idx)
{
std::cout << mV[idx].first << std::endl;
for (int jdx(0); jdx < mV[idx].second.size(); ++jdx)
{
// std::cout << mV[idx].second.[jdx] << std::endl;
}
}
return 0;
}
At issue: I'm having difficulties trying to access the mV 'second'
elements within main. See commented out line.
2/
I need to pull out the texts again for a pointer refresher. I'm using
unsigned char* for doing pointer arithmetic.
So now:
typedef unsigned char* ADDR_TYPE;
int Var(0xD0000000); // known address on PCI bus.
ADDR_TYPE ptr = (ADDR_TYPE)Var;
ptr is a unsigned char pointer. The variable Var is an integer. When
I cast Var to ptr. I'm getting the address of Var. But Var is is an
integer. So the cast to ptr would need enough memory to hold a Var.
I'm tring to determine when ptr would overflow?
# include <iostream>
# include <string>
# include <map>
# include <bitset>
# include <vector>
using namespace std;
typedef unsigned char* ADDR_TYPE;
typedef unsigned int uint_type;
uint_type const NUM_PROC(4);
int CNum2(2);
// Go back to Josuttis and see if I got the right candidate for teh Job
// for now a vector of pairs ...
typedef std:
typedef std::vector< Mypair > myVecPair;
void card2_func( myVecPair& refVec ) // give this function the array
{
int mask(0x10);
if (refVec.size())
{
refVec.clear();
}
uint_type SZ(NUM_PROC * CNum2);
int size(5);
for (int idx(0); idx < 2; ++idx)
{
uint_type lMask = 0x00000001 << (NUM_PROC*(CNum2-1));
uint_type nContor(NUM_PROC * (CNum2 - 1));
bool found_match(false);
for (; nContor < SZ; nContor++)
{
if (mask & lMask)
{
int val = mask & lMask;
refVec[idx].second.push_back(nContor);
printf(" %d\n", nContor);
found_match = true;
}
lMask <<= 1;
}
mask += 0x1;
if ( found_match )
{
refVec[idx].first = size;
}
size += 1;
// cout << " OK " << std::endl;
}
}
int main()
{
myVecPair mV;
card2_func(mV);
for (int idx(0); idx < mV.size(); ++idx)
{
std::cout << mV[idx].first << std::endl;
for (int jdx(0); jdx < mV[idx].second.size(); ++jdx)
{
// std::cout << mV[idx].second.[jdx] << std::endl;
}
}
return 0;
}
At issue: I'm having difficulties trying to access the mV 'second'
elements within main. See commented out line.
2/
I need to pull out the texts again for a pointer refresher. I'm using
unsigned char* for doing pointer arithmetic.
So now:
typedef unsigned char* ADDR_TYPE;
int Var(0xD0000000); // known address on PCI bus.
ADDR_TYPE ptr = (ADDR_TYPE)Var;
ptr is a unsigned char pointer. The variable Var is an integer. When
I cast Var to ptr. I'm getting the address of Var. But Var is is an
integer. So the cast to ptr would need enough memory to hold a Var.
I'm tring to determine when ptr would overflow?