locking for 64 Bit Math in 32 Bit Processor

Hi All,

I'm working in a real time environment, in 32 Bit (arm7)

we want to save processing time ant to change the work in float and use only uint32.
the problem is, that we have a multiplication of 2 32 bit variables. that can be bigger the 32 bit (the resault)
we are using the following struct to save the answer:
struct x {
uint32 high;
uint32 low;
}x;

I already implemented the multipule function and looking for a divide function for that kind of struct (64 bit divide by 32, the resault is 32 bit)

is any one have that kind of code, or any other why that I can implement 32 Bit multiply by 32 Bit?

Thanks
Shahar

Comments

  • [b][red]This message was edited by IDK at 2006-1-23 6:2:52[/red][/b][hr]
    : Hi All,
    :
    : I'm working in a real time environment, in 32 Bit (arm7)
    :
    : we want to save processing time ant to change the work in float and use only uint32.
    : the problem is, that we have a multiplication of 2 32 bit variables. that can be bigger the 32 bit (the resault)
    : we are using the following struct to save the answer:
    : struct x {
    : uint32 high;
    : uint32 low;
    : }x;
    :
    : I already implemented the multipule function and looking for a divide function for that kind of struct (64 bit divide by 32, the resault is 32 bit)
    :
    : is any one have that kind of code, or any other why that I can implement 32 Bit multiply by 32 Bit?
    :
    : Thanks
    : Shahar
    :
    This is plain math:
    ans = high/nominator * 2^32 + low/nominator

    But that won't work.

    This will make some of it work...
    ans = (high*2^16)/nominator * 2^16 + low/nominator

    EDIT: I found this after 5 seconds of surfing...
    http://www.bearcave.com/software/divide.htm


    Happy coding wishes
    the one and only
    [b]Niklas Ulvinge[/b] [white]aka [b]IDK[/b][/white]



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion