Skip to content

Faulty fixed_generic.h macros on some platforms #36

@BojtorBogdanErvin

Description

@BojtorBogdanErvin

There are examples where the macros on fixed_generic.h will return different results between native and platform. On some platforms ADD16(32767,32767) will return 65534, even if the result is stored in a short/ an int, because that platform doesn't have 8-bit addressing and the wrapping occurs at a higher number of bits than the expected 16 (it will happen for 24 bit values).

Same story 32 bit macros. The wrapping will occur at 48 bits, not 32.

It may be redundant if not detrimental to implement a software wrapping for the platforms the code is written for, but for some platforms it doesn't exist "hardware" wrapping for 16 and 32 bits, but for (example) 24 and 48 bits; case where to gurantee bit trueness with the native, a software wrapper must be implemented.

And as a nit pick, MULT16_16 does not work as expected on some platforms, in the sense that it generates bit true differences. It is fixable by replacing it with a platform intrinsic function though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions