Getting SIGILL in float to fixed conversion

Posted by foliveira on Stack Overflow See other posts from Stack Overflow or by foliveira
Published on 2010-04-06T15:08:38Z Indexed on 2010/04/06 15:13 UTC
Read the original article Hit count: 239

Filed under:
|
|

I'm receiving a SIGILL after running the following code. I can't really figure what's wrong with it.

The target platform is ARM, and I'm trying to port a known library (in which this code is contained)

void convertFloatToFixed(float nX, float nY, unsigned int &nFixed) {
    short sx = (short) (nX * 32);
    short sy = (short) (nY * 32);

    unsigned short *ux = (unsigned short*) &sx;
    unsigned short *uy = (unsigned short*) &sy;

    nFixed = (*ux << 16) | *uy;
}

Any help on it would be greatly appreciated.

Thanks in advance

© Stack Overflow or respective owner

Related posts about c++

Related posts about arm