This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

64bit arithmetic on Cortex-M0

Hello :)

I am writing a C program that I would like to import to an ARM Cortex-M0.

As new(very new) to the field I have a question that annoys me some days now.

From Generic User Guide of M0 I can see that i can multiply two 32bit numbers but only if they producing a 32 bit result. (so really multiply 16bit numbers but declared as 32 bit?)
infocenter.arm.com/.../index.jsp

1) If I declare something int64_t in my code the compiler will save the value in two 32 bit registers?

2) Isn't 32 bit multiplication providing a 64bit result? It just throws the 32MSBs?

I am asking these cause I would like to do some calculations with 64 bit values and I do not know with what way to continue. (if question 1 is true then the multiplication is done quite easily)

Thank you,

Demetris

Parents
  • If you define variables as uint64_t, then the compiler and the libraries hide all the ugly detail about what the processor is/is not capable of at an instruction set level. What the hardware can't do, software does instead, just slower. No hardware divide either, is there?

    Yes, 64-bit values will be handled as two 32-bit words, or a bit at a time.

    8-bit processors can handle 64-bit values too, just a byte at a time..

Reply
  • If you define variables as uint64_t, then the compiler and the libraries hide all the ugly detail about what the processor is/is not capable of at an instruction set level. What the hardware can't do, software does instead, just slower. No hardware divide either, is there?

    Yes, 64-bit values will be handled as two 32-bit words, or a bit at a time.

    8-bit processors can handle 64-bit values too, just a byte at a time..

Children