# ARM math question

#### Diodac

##### Well-known member
Hey guys.
I just wondering if possible is moving this function to arm math and floating operations. I’m totally new with arm math and not sure.

Code:
``````// Multi ++++++++++++++++++++
inline uint32_t M32x16(uint32_t x, uint32_t y) {
return (uint32_t)(((uint32_t)x) * ((uint32_t)y) >> 16);
}

resultA = M32x16(outputA, (distance << 7));
resultB = M32x16(outputB, (((SIZE >> 1) - distance) << 7));

for( int pointer = 0; pointer < 128; pointer++){
bufferOut[pointer] = resultA += resultB;
}``````

I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?

I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?
I just want do some calculations in floating point and looking how to do using CMSIS DSP
Above code is just a part full version of my pseudo realtime code which is here

I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?

I working on new DSP code now, I got to work queue record and convert audio from int16 to float32 and from float32 to int16 for play queue using arm math function.
Now I need find proper equivalent functions for replacement my old M32x16.

There are no DSP instructions for float.
It's integer only.
So, for a float multiplication just use "*" (which is pretty fast)

The M32x16() function looks like a fixed point operation. Sort of. Works with any C compiler but is of course faster on targets with hardware multiply. Like some ARM chips. Floating point and integer multiply on the Teensy 3.6 are equally fast.

Although for fixed point what I usually look for is something that returns the full size of the multiply. Which would be 64 bits for a 32X32 multiply. Alas, C can't do that so you have to resort to assembly.

The M32x16() function looks like a fixed point operation. Sort of. Works with any C compiler but is of course faster on targets with hardware multiply. Like some ARM chips. Floating point and integer multiply on the Teensy 3.6 are equally fast.

Although for fixed point what I usually look for is something that returns the full size of the multiply. Which would be 64 bits for a 32X32 multiply. Alas, C can't do that so you have to resort to assembly.

I rewrote my code and I was able get it to work with ARM hardware multiply using mult32x64 and mixing outputA and outputB by clip_q31_to_q15.
It working nice better than I expected.
I writing now code for floating point operation and see how it works.
I will share my code when I finish it.
Thank you for input.