Debug quick c++

Closed Posted 6 years ago Paid on delivery
Closed Paid on delivery

Please can you fix the bug where i'm getting for some values of orderReverse -1 original value from order ?

//main

int order[4] = { 0 };

while (nDataLen >= 2 * 4)

{

func3(order, readFile);

unsigned int previous = 0;

unsigned int w = 1;

for (int i = 0; i < 4; i++) {

previous += w * (order[i]);

w *= 256;

}

}

char bitStringr[33] = {'0'};

Get_string32_from_SIZE4_VALUE(bitStringr, previous);

int orderReverse[56];

orderReverse[0] = Get_CHAR_ARRAY_SIZE4_FROM_VALUE(bitStringr);

int ic = 0;

char bitStringr1[33] = {'0'};

for (int i = 8; i < 16; i++ ) {

bitStringr1[ic] = bitStringr[i]; ic++;

}

orderReverse[1] = Get_CHAR_ARRAY_SIZE4_FROM_VALUE(bitStringr1);

ic = 0;

for (int i = 16; i < 24; i++) {

bitStringr1[ic] = bitStringr[i]; ic++;

}

orderReverse[2] = Get_CHAR_ARRAY_SIZE4_FROM_VALUE(bitStringr1);

ic = 0;

for (int i = 24; i < 32; i++) {

bitStringr1[ic] = bitStringr[i]; ic++;

}

orderReverse[3] = Get_CHAR_ARRAY_SIZE4_FROM_VALUE(bitStringr1);

//Functions

void Get_string32_from_SIZE4_VALUE(char* sz_output, unsigned int val)

{

sz_output[0] = 0;

unsigned int v = 1;

unsigned int n = 0;

for (int i = 0; i < 32; i++)

{

sz_output[n++] = (val & v) ? '1' : '0';

v <<= 1;

}

sz_output[n] = 0;

}

char Get_CHAR_ARRAY_SIZE4_FROM_VALUE(char* sz_input)

{

unsigned short v = 1;

unsigned short n = 0;

for (int i = 0; i < 32; i++)

{

n += (sz_input[i] == '1') ? v : 0;

v <<= 1;

}

return n;

}

void func3(int* dst_Array, FILE* src_InputFile)

{

char buf[8];/////////////////////////////

fread(buf, 1, 8, src_InputFile);

for (int i = 0; i < 4; i++)

{

dst_Array[i] = buf[i];

}

}

C Programming C++ Programming

Project ID: #13810075

About the project

8 proposals Remote project Active 6 years ago

8 freelancers are bidding on average ₹1306 for this job

nitekum

12+ years in C++ Design and Development. Current role in SW architect in GE research . Having experience of IBM Research , Toshiba Research , TIVo inc . If you want to work with highly experienced and best in cla More

₹1750 INR in 1 day
(1 Review)
3.4
duality1333

Good day, I'd be happy to assist you with this task. I have extensive experience in C++ as it was the primary language used for all projects while completing my degree (education) in Canada. Please PM me to discu More

₹1450 INR in 1 day
(1 Review)
0.8
JeffersoonNG

Hi, I'm very interested in getting this job. I can give you the results you are expecting in 10 minutes. I only need information about some missing variables in your code (nDataLen, readFile and previous). Thank More

₹1250 INR in 0 days
(0 Reviews)
0.0
techfinity3

DDear Prospect Hiring Manager. Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have More

₹1361 INR in 7 days
(0 Reviews)
0.0
ramkishangurjar

i am good with c++, and have great knowledge and experience. i think i can debug your code on time. looking forward to work on this.

₹750 INR in 1 day
(0 Reviews)
0.0
skriyaz09

I have been working as a software developer for more than one and half year on C++ and having good knowledge of algorithms and data structures and good problem solving skills and debugging skills

₹1450 INR in 1 day
(0 Reviews)
0.0
dipta007

Hi, I am Dipta. I am a contest programmer and my fav language is c/c++.. I am an ex-software developer in a reputed company in Bangladesh and working in this field for 2 years. Through this, I have gathered a good kno More

₹850 INR in 1 day
(0 Reviews)
0.0