473,473 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2215
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
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.