473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple byte integers

I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}

Jun 11 '06 #1
7 2212
Shuga schrieb:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


The problem is on line 42.

See here: http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

--
Thomas
Jun 11 '06 #2
Shuga wrote:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


It would be a lot easier to help if we could see the definitions of ma,
mb, a, pr1, carry, radix, and m. Also perhaps an explanation of what
you expect the code to be doing.

--
Alan Johnson
Jun 11 '06 #3
Pls post the whole code!
Shuga 写道:
I got a pointer problem, it finishes and takes the previous ma first
element dgt.

if(ma.numdgt > mb.numdgt)
{
a = int(pr1 -> dgt) + carry;
if(((pr1 -> dgt) + carry) > radix)
{
carry = a / radix;
a = a % radix;
}
else carry = 0;
m.append(a);
cout << a << ' ';
}


Jun 12 '06 #4
Hi there,
Thanks for your concern. It's too long. I did try. If you like give
me your full email and I try to send it to you.

Jun 14 '06 #5

Hi Alan,
Thank for your concern.
ma, mb and m are classes. I trying to add ma + mb into m.
Carry is int stored into a byte. Radix is an integer base 256.
The code is too long to be posted. If you're interested give me your
full email and I will try to send you

Shuga

Jun 14 '06 #6

Hi Alan,
Thank for your concern.
ma, mb and m are classes. I trying to add ma + mb into m.
Carry is int stored into a byte. Radix is an integer base 256.
The code is too long to be posted. If you're interested give me your
full email and I will try to send you

Shuga

Jun 14 '06 #7
I have a multiple byte integers working with pointers. When I add two
of these integers I get the last digit added to the old first digit. It
working on an if statement. The msg. I get is Thread stopped at(file
name + path) Access violation at 0x401ff4 read of address 0x0.

Shuga

Jun 22 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: w3r3w0lf | last post by:
hello! I have a following situation: I have a byte array where at a certain location are stored 4 bytes, and these should be "put" into long variable (or any other 4 byte one). ie: byte...
235
by: napi | last post by:
I think you would agree with me that a C compiler that directly produces Java Byte Code to be run on any JVM is something that is missing to software programmers so far. With such a tool one could...
20
by: adityavasishth | last post by:
hi all, Characters are basically implemented via integers,ex : '\0' is 0.But integers requires 2 bytes and the characters require only 1 byte.So,can anybody please tell me that how the...
4
by: Dennis Myrn | last post by:
Hi. Is there a way to utilize the great primitive data type formatting routines available in .NET without working with strings? I want a byte directly rather than a string. I think it is...
16
by: dylanthomasfan | last post by:
I want to know how one can use and manipulate byte-sized integers in C. Byte-sized integears are useful where one uses them in arrays declared in the heap, so it makes sense not to declare ints...
45
by: Ajay | last post by:
Hi all,can you please tell the most efficient method to reverse a byte.Function should return a byte that is reversed.
18
by: p.lavarre | last post by:
Can Python not express the idea of a three-byte int? For instance, in the working example below, can we somehow collapse the three calls of struct.pack into one? 08 12 34 56 80 00 I ask...
12
by: Godzilla | last post by:
Hello, I'm trying to find a way to convert an integer (8-bits long for starters) and converting them to a list, e.g.: num = 255 numList = with the first element of the list being the...
11
by: K Viltersten | last post by:
While i know that the bytes are cheap today, i still prefer to use a byte (or short) when i know that the entity counted isn't larger than 255 (or 65k). However, it's a real pain to cast every...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.