8_24 conversion
Hi,
I have a doubt,
I would like to know how and where SIGMASTUDIOTYPE_8_24_CONVERT is defined.
Anyone can help me?
Thnaks in advance
8.24
8_24
micronctroller
SigmaDSP
It doesn't seem to be defined anywhere, but a suitable definition would presumably be:
#define SIGMASTUDIOTYPE_8_24_CONVERT(x) ((int32_t)((x)*0x1000000))
I suppose that actually is:
#define SIGMASTUDIOTYPE_8_24_CONVERT(x) ((int32_t)((x)* 0x01 << 24))
But the real question is whether I can use it in my own code or I have to define an equivalent mine.
Oh, that seems to be missing in the export files I checked (which were just some random old export I had sitting around).
That definition is actually wrong though due to operator precedence, and will result in a compile error if you try to use a constant that uses the macro if defined like that:
test.c:2:62: error: invalid operands to binary << (have ‘double’ and ‘int’)
2 | #define SIGMASTUDIOTYPE_8_24_CONVERT(x) ((int32_t)((x)* 0x01 << 24))
| ~~~~~~~~~ ^~
| |
| double
It needs parentheses around the "0x01 << 24", at which point it's 100% equivalent to the definition I gave (except I just wrote 0x1000000 instead of 1 << 24).
I'm not sure what you mean by your question.
Please log in to reply.