cocos2d/cocos/audio/android/audio_utils/include/audio_utils/primitives.h
static inline uint32_t u4_28_from_float(float f)
{
    static const float scale = (float)(1 << 28);
    static const float limpos = 0xffffffffUL / (float)(1 << 28);

    if (f <= 0.) {
        return 0;
    } else if (f >= limpos) {
        return 0xffffffff;
    }
    /* integer conversion is through truncation (though int to float is not).
     * ensure that we round to nearest, ties away from 0.
     */
    return f * scale + 0.5;
}
/* Convert a single-precision floating point value to a U4.28 integer value.
 * Rounds to nearest, ties away from 0.
 *
 * Values outside the range [0, 16.0] are properly clamped to [0, 4294967295]
 * including -Inf and +Inf. NaN values are considered undefined, and behavior may change
 * depending on hardware and future implementation of this function.
 */
Convert a single-precision floating point value to a U4.28 integer value.
Rounds to nearest, ties away from 0.

Values outside the range [0, 16.0] are properly clamped to [0, 4294967295]
including -Inf and +Inf. NaN values are considered undefined, and behavior may change
depending on hardware and future implementation of this function.
Convert a single - precision floating point value to a U4 . 28 integer value . Rounds to nearest ties away from 0 . Values outside the range [ 0 16 . 0 ] are properly clamped to [ 0 4294967295 ] including - Inf and + Inf . NaN values are considered undefined and behavior may change depending on hardware and future implementation of this function .
static inline uint32_t u4_28_from_float(float f)
{
    static const float scale = (float)(1 << 28);
    static const float limpos = 0xffffffffUL / (float)(1 << 28);
    if (f <= 0.) {
        return 0;
    } else if (f >= limpos) {
        return 0xffffffff;
    }
    return f * scale + 0.5;
}
static inline uint32_t u4_28_from_float ( float f ) { static const float scale = ( float ) ( 1 << 28 ) ; static const float limpos = 0xffffffffUL / ( float ) ( 1 << 28 ) ; if ( f <= 0. ) { return 0 ; } else if ( f >= limpos ) { return 0xffffffff ; } return f * scale + 0.5 ; }
Convert a single-precision floating point value to a U4.28 integer value.
Convert a single - precision floating point value to a U4 . 28 integer value .
/* integer conversion is through truncation (though int to float is not).
     * ensure that we round to nearest, ties away from 0.
     */