linux-assembly.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Marmond <fmarmond@eprocess.fr>
To: Vadiraj C S <vadiraj@mail.cyberneme.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: newbie :adding larger value
Date: Thu, 27 Nov 2003 09:07:33 +0100	[thread overview]
Message-ID: <3FC5B0C5.9040009@eprocess.fr> (raw)
In-Reply-To: <20031127124723.6b3aeb07.vadiraj@mail.cyberneme.com>

hum, as a float ar as an integer?

i don't have much time to take care of all cases, here is the basic:

64bits integer not signed:
you must add the lower 32 bits, take care of the carry, add this to the 
upper 32 bits and add then the upper 32 bits. (but you may loose the 
upper carry...)
something like this:

;add 64 bits eax(upper 32bits)ebx(lower 32bits)
;to 64 bits ecx(upper) edx(lower)
add edx,ebx      ;add the lower 32 bits
jnc no_lowcarry      : if no carry, just add the upper 32bits
    inc ecx            ;if carry, increments the upper 32bits
no_lowcarry:
add ecx,eax   ;add the upper 32bits

jnc no_upcarry
    ;error: this would result to a 65 bits number (too big to stands in 
a 64 bits number)
    ;handle it here
no_upcarry:

Fred


Vadiraj C S wrote:

>  Hello Everyone..
>
>   I'm a newbie. Has any one worked on adding a large value in assembly. I mean
> a value which is larger than 32 bit. How is this mathematics taken care...
>
>
>
>
>
>  
>



  reply	other threads:[~2003-11-27  8:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-27  7:17 newbie :adding larger value Vadiraj C S
2003-11-27  8:07 ` Frederic Marmond [this message]
2003-11-27 15:20   ` Philip Jacob Smith
2003-11-28  6:59     ` Frederic Marmond
2003-11-27 12:41 ` peter willy krause
2003-11-27 11:51   ` Vadiraj C S
2003-11-27 12:57   ` peter willy krause
2003-11-27 16:34 ` Randall Hyde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3FC5B0C5.9040009@eprocess.fr \
    --to=fmarmond@eprocess.fr \
    --cc=linux-assembly@vger.kernel.org \
    --cc=vadiraj@mail.cyberneme.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).