Jump to main content

##

# 3.9.17 GET_VALUE_SHIFT Macro

## C

    #define GET_VALUE_SHIFT     mcUtils_FloatToValueShiftPair

## Summary

Convert a float value to a fixed-point integer value and its corresponding shift amount.

## Description

This macro is an alias for the `mcUtils_FloatToValueShiftPair` function, which converts a floating-point number into a pair consisting of a 16-bit integer value and a shift value, effectively encoding the floating-point number for use in fixed-point arithmetic.

## Example

    void mcUtils_FloatToValueShiftPair(const float32_t input, int16_t * const value, uint16_t * const shift)
    {
    }

    float32_t input = 0.125f;
    int16_t value;
    uint16_t shift;

    GET_VALUE_SHIFT(input, &value, &shift);

## Remarks

None