spinn_common 7.3.1
Support code for SpiNNaker applications.
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
stdfix-full-iso.h File Reference

Additions to the stdfix.h file to support full Draft ISO/IEC standards compliance. More...

#include <stdint.h>
#include <stdbool.h>
#include "arm_acle.h"
#include <stdfix.h>

Go to the source code of this file.

Macros

#define min(a, b)   (((a)<(b)) ? (a) : (b))
 Returns the minimum of two arguments.
 
#define __stdfix_max(a, b)    (((a)<(b)) ? (b) : (a))
 Returns the maximum of two arguments.
 
#define __stdfix_use(a)    do {} while ((a)!=(a))
 A macro definition which pretends to use variable a.
 
#define __stdfix_abs(a)    (((a)<0) ? -(a) : (a))
 Returns the absolute value of its argument.
 
#define __stdfix_ms_u32(x)    ((x) >> 32)
 Returns the most significant 32-bits of a 64-bit argument.
 
#define __stdfix_ls_u32(x)    ((x) & UINT32_MAX)
 Returns the least significant 32-bits of a 64-bit argument.
 
#define __I(x)   ((int) (x))
 Cast to int.
 
#define __I32(x)   ((int32_t) (x))
 Cast to int32_t.
 
#define __I64(x)   ((int64_t) (x))
 Cast to int64_t.
 
#define __LI(x)   ((long int) (x))
 Cast to long int.
 
#define __U32(x)   ((uint32_t) (x))
 Cast to uint32_t.
 
#define __U64(x)   ((uint64_t) (x))
 Cast to uint64_t.
 
#define __UI(x)   ((unsigned int) (x))
 Cast to unsigned int.
 
#define __ULI(x)   ((unsigned long int) (x))
 Cast to unsigned long int.
 
7.18a.6.7

Type-generic fixed-point functions

For each of the fixed-point absolute value functions in 7.18a.6.2, the fixed-point rounding functions in 7.18a.6.3 and the fixed-point countls functions in 7.18a.6.4, a type-generic macro is defined as follows:

                                              type-generic macro
 the fixed-point absolute value functions     absfx
 the fixed-point rounding functions           roundfx
 the fixed-point countls functions            countlsfx

For each macro, use of the macro invokes the function whose corresponding type and type domain is the fixed-point type of the first generic argument. If the type of the first generic argument is not a fixed-point type, the behavior is undefined

#define absfx(f)
 This macro provides type-generic access to the absolute value functions.
 
#define roundfx(f, n)
 This macro provides type-generic access to the rounding functions.
 
#define countlsfx(f)
 This macro provides type-generic access to the functions for counting leading sign-bits.
 

Typedefs

typedef short fract s07
 An alternative name for the signed short fract type.
 
typedef fract s015
 An alternative name for the signed fract type.
 
typedef long fract s031
 An alternative name for the signed long fract type.
 
typedef short accum s87
 An alternative name for the signed short accum type.
 
typedef accum s1615
 An alternative name for the signed accum type.
 
typedef long accum s3231
 An alternative name for the signed long accum type.
 
typedef unsigned short fract u08
 An alternative name for the unsigned short fract type.
 
typedef unsigned fract u016
 An alternative name for the unsigned fract type.
 
typedef unsigned long fract u032
 An alternative name for the unsigned long fract type.
 
typedef unsigned short accum u88
 An alternative name for the unsigned short accum type.
 
typedef unsigned accum u1616
 An alternative name for the unsigned accum type.
 
typedef unsigned long accum u3232
 An alternative name for the unsigned long accum type.
 
7.18a.2

Integer types used for the bits conversion functions

typedef int8_t int_hr_t
 This is the integer type into which signed short fract can be converted.
 
typedef int16_t int_r_t
 This is the integer type into which signed fract can be converted.
 
typedef int32_t int_lr_t
 This is the integer type into which signed long fract can be converted.
 
typedef int16_t int_hk_t
 This is the integer type into which signed short accum can be converted.
 
typedef int32_t int_k_t
 This is the integer type into which signed accum can be converted.
 
typedef int64_t int_lk_t
 This is the integer type into which signed long accum can be converted.
 
typedef uint8_t uint_uhr_t
 This is the unsigned integer type into which unsigned short accum can be converted.
 
typedef uint16_t uint_ur_t
 This is the unsigned integer type into which unsigned fract can be converted.
 
typedef uint32_t uint_ulr_t
 This is the unsigned integer type into which unsigned long fract can be converted.
 
typedef uint16_t uint_uhk_t
 This is the unsigned integer type into which unsigned short accum can be converted.
 
typedef uint32_t uint_uk_t
 This is the unsigned integer type into which unsigned accum can be converted.
 
typedef uint64_t uint_ulk_t
 This is the unsigned integer type into which unsigned long accum can be converted.
 

Functions

void __stdfix_64x64_128 (uint64_t *hi, uint64_t *lo, uint64_t x, uint64_t y)
 Multiplies two 64-bit unsigned integers returning a 128-bit result in hi and lo.
 
static int32_t __stdfix_sat_hr (const int32_t x)
 Saturates an integer to 8 bits.
 
static int32_t __stdfix_sat_r (const int32_t x)
 Saturates an integer to 16 bits.
 
static int32_t __stdfix_sat_lr (const int64_t x)
 Saturates a 64-bit integer to 32-bits.
 
static int32_t __stdfix_sat_hk (const int32_t x)
 Saturates an integer to 16 bits.
 
static int32_t __stdfix_sat_k (const int64_t x)
 Saturates a 64-bit integer to 32-bits.
 
static uint32_t __stdfix_sat_uhr (const uint32_t x)
 Saturates an unsigned integer to 8 bits.
 
static uint32_t __stdfix_sat_ur (const uint32_t x)
 Saturates an unsigned integer to 16 bits.
 
static uint32_t __stdfix_sat_ulr (const uint64_t x)
 Saturates an unsigned 64-bit integer to 32 bits.
 
static uint32_t __stdfix_sat_uhk (const uint32_t x)
 Saturates an unsigned integer to 16 bits.
 
static uint32_t __stdfix_sat_uk (const uint64_t x)
 Saturates an unsigned 64-bit integer to 32 bits.
 
static int32_t __stdfix_sadd_hr (int_hr_t x, int_hr_t y)
 Saturated addition of the underlying integer representations.
 
static int32_t __stdfix_ssub_hr (int_hr_t x, int_hr_t y)
 Saturated subtraction of the underlying integer representations.
 
static int32_t __stdfix_sneg_hr (int_hr_t x)
 Saturated negation of the underlying integer representations.
 
static int32_t __stdfix_sadd_r (int32_t x, int32_t y)
 Saturated addition of the underlying integer representations.
 
static int32_t __stdfix_ssub_r (int32_t x, int32_t y)
 Saturated subtraction of the underlying integer representations.
 
static int32_t __stdfix_sneg_r (int32_t x)
 Saturated negation of the underlying integer representations.
 
static int32_t __stdfix_sadd_lr (int32_t x, int32_t y)
 Saturated addition of the underlying integer representations.
 
static int32_t __stdfix_ssub_lr (int32_t x, int32_t y)
 Saturated subtraction of the underlying integer representations.
 
static int32_t __stdfix_sneg_lr (int32_t x)
 Saturated negation of the underlying integer representations.
 
static int32_t __stdfix_sadd_hk (int32_t x, int32_t y)
 Saturated addition of the underlying integer representations.
 
static int32_t __stdfix_ssub_hk (int32_t x, int32_t y)
 Saturated subtraction of the underlying integer representations.
 
static int32_t __stdfix_sneg_hk (int32_t x)
 Saturated negation of the underlying integer representations.
 
static int32_t __stdfix_sadd_k (int32_t x, int32_t y)
 Saturated addition of the underlying integer representations.
 
static int32_t __stdfix_ssub_k (int32_t x, int32_t y)
 Saturated subtraction of the underlying integer representations.
 
static int32_t __stdfix_sneg_k (int32_t x)
 Saturated negation of the underlying integer representations.
 
int64_t __stdfix_sadd_lk (int64_t x, int64_t y)
 Saturated addition of the underlying integer representations.
 
int64_t __stdfix_ssub_lk (int64_t x, int64_t y)
 Saturated subtraction of the underlying integer representations.
 
int64_t __stdfix_sneg_lk (int64_t x)
 Saturated negation of the underlying integer representations.
 
static int32_t __stdfix_smul_hr (int32_t x, int32_t y)
 Saturated multiplication of the underlying integer representations.
 
static int32_t __stdfix_smul_r (int32_t x, int32_t y)
 Saturated multiplication of the underlying integer representations.
 
static int32_t __stdfix_smul_lr (int32_t x, int32_t y)
 Saturated multiplication of the underlying integer representations.
 
static int32_t __stdfix_smul_hk (int32_t x, int32_t y)
 Saturated multiplication of the underlying integer representations.
 
static int32_t __stdfix_smul_k (int32_t x, int32_t y)
 Saturated multiplication of the underlying integer representations.
 
int64_t __stdfix_smul_lk (int64_t x, int64_t y)
 Saturated multiplication of the underlying integer representations.
 
static uint32_t __stdfix_sadd_uhr (uint32_t x, uint32_t y)
 Saturated addition of the underlying unsigned integer representations.
 
static uint32_t __stdfix_ssub_uhr (uint32_t x, uint32_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
static uint32_t __stdfix_sadd_ur (uint32_t x, uint32_t y)
 Saturated addition of the underlying unsigned integer representations.
 
static uint32_t __stdfix_ssub_ur (uint32_t x, uint32_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
static uint32_t __stdfix_sadd_ulr (uint32_t x, uint32_t y)
 Saturated addition of the underlying unsigned integer representations.
 
static uint32_t __stdfix_ssub_ulr (uint32_t x, uint32_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
static uint32_t __stdfix_sadd_uhk (uint32_t x, uint32_t y)
 Saturated addition of the underlying unsigned integer representations.
 
static uint32_t __stdfix_ssub_uhk (uint32_t x, uint32_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
static uint32_t __stdfix_sadd_uk (uint32_t x, uint32_t y)
 Saturated addition of the underlying unsigned integer representations.
 
static uint32_t __stdfix_ssub_uk (uint32_t x, uint32_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
uint64_t __stdfix_sadd_ulk (uint64_t x, uint64_t y)
 Saturated addition of the underlying unsigned integer representations.
 
uint64_t __stdfix_ssub_ulk (uint64_t x, uint64_t y)
 Saturated subtraction of the underlying unsigned integer representations.
 
static uint32_t __stdfix_smul_uhr (uint32_t x, uint32_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
static uint32_t __stdfix_smul_ur (uint32_t x, uint32_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
static uint32_t __stdfix_smul_ulr (uint32_t x, uint32_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
static uint32_t __stdfix_smul_uhk (uint32_t x, uint32_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
static uint32_t __stdfix_smul_uk (uint32_t x, uint32_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
uint64_t __stdfix_smul_ulk (uint64_t x, uint64_t y)
 Saturated multiplication of the underlying unsigned integer representations.
 
7.18a.6.5

The bitwise fixed-point to integer conversion functions

static int_hr_t bitshr (const s07 f)
 Converts a short fract into an integer.
 
static int_r_t bitsr (const s015 f)
 Converts a fract into an integer.
 
static int_lr_t bitslr (const s031 f)
 Converts a long fract into an integer.
 
static int_hk_t bitshk (const s87 f)
 Converts a short accum into an integer.
 
static int_k_t bitsk (const s1615 f)
 Converts an accum into an integer.
 
static int_lk_t bitslk (const s3231 f)
 Converts a long accum into an integer.
 
static uint_uhr_t bitsuhr (const u08 f)
 Converts an unsigned short fract into an integer.
 
static uint_ur_t bitsur (const u016 f)
 Converts an unsigned fract into an integer.
 
static uint_ulr_t bitsulr (const u032 f)
 Converts an unsigned long fract into an integer.
 
static uint_uhk_t bitsuhk (const u88 f)
 Converts an unsigned short accum into an integer.
 
static uint_uk_t bitsuk (const u1616 f)
 Converts an unsigned accum into an integer.
 
static uint_ulk_t bitsulk (const u3232 f)
 Converts an unsigned long accum into an integer.
 
7.18a.6.6

The bitwise integer to fixed-point conversion functions

static s07 hrbits (const int_hr_t n)
 Converts a signed integer into a signed short fract.
 
static s015 rbits (const int_r_t n)
 Converts a signed integer into a signed fract.
 
static s031 lrbits (const int_lr_t n)
 Converts a signed integer into a signed long fract.
 
static s87 hkbits (const int_hk_t n)
 Converts a signed integer into a signed short accum.
 
static s1615 kbits (const int_k_t n)
 Converts a signed integer into a signed accum.
 
static s3231 lkbits (const int_lk_t n)
 Converts a signed integer into a signed long accum.
 
static u08 uhrbits (const uint_uhr_t n)
 Converts an unsigned integer into an unsigned short fract.
 
static u016 urbits (const uint_ur_t n)
 Converts an unsigned integer into an unsigned fract.
 
static u032 ulrbits (const uint_ulr_t n)
 Converts an unsigned integer into an unsigned long fract.
 
static u88 uhkbits (const uint_uhk_t n)
 Converts an unsigned integer into an unsigned short accum.
 
static u1616 ukbits (const uint_uk_t n)
 Converts an unsigned integer into an unsigned accum.
 
static u3232 ulkbits (const uint_ulk_t n)
 Converts an unsigned integer into an unsigned long accum.
 
7.18a.6.1

The fixed-point arithmetic operation support functions

These functions compute the mathematically exact result of the multiplication or division operation on the operands with the indicated types, and return a value with the indicated type.

For functions returning an integer value, the return value is rounded towards zero. For functions returning a fixed-point value, the return value is saturated on overflow. If the second operand of one of the divide functions is zero, the behavior is undefined.

static int mulir (int n, s015 x)
 Multiplies an integer by a fract giving an integer answer.
 
static long int mulilr (long int n, s031 x)
 Multiplies a long integer by a long fract giving an integer answer.
 
static int mulik (int n, s1615 x)
 Multiplies an integer by an accum giving an integer answer.
 
static long int mulilk (long int n, s3231 x)
 Multiplies a long integer by a long accum giving a long integer answer.
 
static int divir (int n, s015 x)
 Divides an integer by a fract giving an integer answer.
 
static long int divilr (long int n, s031 x)
 Divides a long integer by a long fract giving a long integer answer.
 
static int divik (int n, s1615 x)
 Divides an integer by an accum giving an integer answer.
 
static long int divilk (long int n, s3231 x)
 Divides an integer by a long accum giving a long integer answer.
 
static s015 rdivi (int i, int j)
 Divides two integers giving a fract answer.
 
static s031 lrdivi (long int i, long int j)
 Divides two integers giving a long fract answer.
 
static s1615 kdivi (int i, int j)
 Divides two integers giving an accum answer.
 
static s3231 lkdivi (long int i, long int j)
 Divides two integers giving a long accum answer.
 
static int idivr (s015 x, s015 y)
 Divides two fracts giving an integer answer.
 
static long int idivlr (s031 x, s031 y)
 Divides two long fracts giving a long integer answer.
 
static int idivk (s1615 x, s1615 y)
 Divides two accums giving an integer answer.
 
static long int idivlk (s3231 x, s3231 y)
 Divides two long accums giving a long integer answer.
 
static unsigned int muliur (unsigned int n, u016 x)
 Multiplies an unsigned integer by an unsigned fract giving an unsigned integer answer.
 
static unsigned long int muliulr (unsigned long int n, u032 x)
 Multiplies an unsigned long integer by an unsigned long fract giving an unsigned integer answer.
 
static unsigned int muliuk (unsigned int n, u1616 x)
 Multiplies an unsigned integer by an unsigned accum giving an unsigned integer answer.
 
static unsigned long int muliulk (unsigned long int n, u3232 x)
 Multiplies an unsigned long integer by an unsigned long accum giving an unsigned long integer answer.
 
static unsigned int diviur (unsigned int n, u016 x)
 Divides an unsigned integer by an unsigned fract giving an unsigned integer answer.
 
static unsigned long int diviulr (unsigned long int n, u032 x)
 Divides a long unsigned integer by a long unsigned fract giving an unsigned integer answer.
 
static unsigned int diviuk (unsigned int n, u1616 x)
 Divides an unsigned integer by an unsigned accum giving an unsigned integer answer.
 
static unsigned long int diviulk (unsigned long int n, u3232 x)
 Divides a long unsigned integer by a long unsigned accum giving an unsigned integer answer.
 
static u016 urdivi (unsigned int i, unsigned int j)
 Divides two unsigned integers giving an unsigned fract answer.
 
static u032 ulrdivi (unsigned long int i, unsigned long int j)
 Divides two unsigned long integers giving an unsigned long fract answer.
 
static u1616 ukdivi (unsigned int i, unsigned int j)
 Divides two unsigned integers giving an unsigned accum answer.
 
static u3232 ulkdivi (unsigned long int i, unsigned long int j)
 Divides two unsigned long integers giving an unsigned long accum answer.
 
static unsigned int idivur (u016 x, u016 y)
 Divides two unsigned fracts giving an unsigned integer answer.
 
static unsigned long int idivulr (u032 x, u032 y)
 Divides two unsigned long fracts giving an unsigned long integer answer.
 
static unsigned int idivuk (u1616 x, u1616 y)
 Divides two unsigned accums giving an unsigned integer answer.
 
static unsigned long int idivulk (u3232 x, u3232 y)
 Divides two unsigned long accums giving an unsigned long integer answer.
 
7.18a.6.2

The fixed-point absolute value functions

These functions compute the absolute value of a fixed-point value f.

The functions return |f|. If the exact result cannot be represented, the saturated result is returned.

static s07 abshr (s07 f)
 This function returns the absolute value of a short fract.
 
static s015 absr (s015 f)
 This function returns the absolute value of a fract.
 
static s031 abslr (s031 f)
 This function returns the absolute value of a long fract.
 
static s87 abshk (s87 f)
 This function returns the absolute value of a short accum.
 
static s1615 absk (s1615 f)
 This function returns the absolute value of an accum.
 
static s3231 abslk (s3231 f)
 This function returns the absolute value of a long accum.
 
7.18a.6.3

The fixed-point rounding functions

These functions compute the value of f, rounded to the number of fractional bits specified in n. The rounding applied is to-nearest, with unspecified rounding direction in the halfway case. When saturation has not occurred, fractional bits beyond the rounding point are set to zero in the result. The value of n must be nonnegative and less than the number of fractional bits in the fixed-point type of f.

The rounding functions return the rounded result, as specified. If the value of n is negative or larger than the number of fractional bits in the fixed-point type of f, the result is unspecified. If the exact result cannot be represented, the saturated result is returned.

static uint8_t __stdfix_round_u8 (uint8_t x, int n)
 This function rounds the input unsigned 8-bit integer to a number of bits, returning an 8-bit integer.
 
static uint16_t __stdfix_round_u16 (uint16_t x, int n)
 This function rounds the input unsigned 16-bit integer to a number of bits, returning a 16-bit integer.
 
static uint32_t __stdfix_round_u32 (uint32_t x, int n)
 This function rounds the input unsigned 32-bit integer to a number of bits, returning a 32-bit integer.
 
static uint64_t __stdfix_round_u64 (uint64_t x, int n)
 This function rounds the input unsigned 64-bit integer to a number of bits, returning a 64-bit integer.
 
static int8_t __stdfix_round_s8 (int8_t x, int n)
 This function rounds the input signed 8-bit integer to a number of bits, returning an 8-bit integer.
 
static int16_t __stdfix_round_s16 (int16_t x, int n)
 This function rounds the input signed 16-bit integer to a number of bits, returning a 16-bit integer.
 
static int32_t __stdfix_round_s32 (int32_t x, int n)
 This function rounds the input signed 32-bit integer to a number of bits, returning a 32-bit integer.
 
static int64_t __stdfix_round_s64 (int64_t x, int n)
 This function rounds the input signed 64-bit integer to a number of bits, returning a 64-bit integer.
 
static s07 roundhr (s07 f, int n)
 This function rounds the input short fract to a number of bits, returning a short fract.
 
static s015 roundr (s015 f, int n)
 This function rounds the input fract to a number of bits, returning a fract.
 
static s031 roundlr (s031 f, int n)
 This function rounds the input long fract to a number of bits, returning a long fract.
 
static s87 roundhk (s87 f, int n)
 This function rounds the input short accum to a number of bits, returning a short accum.
 
static s1615 roundk (s1615 f, int n)
 This function rounds the input accum to a number of bits, returning an accum.
 
static s3231 roundlk (s3231 f, int n)
 This function rounds the input long accum to a number of bits, returning a long accum.
 
static u08 rounduhr (u08 f, int n)
 This function rounds the input unsigned short fract to a number of bits, returning an unsigned short fract.
 
static u016 roundur (u016 f, int n)
 This function rounds the input unsigned fract to a number of bits, returning an unsigned fract.
 
static u032 roundulr (u032 f, int n)
 This function rounds the input unsigned long fract to a number of bits, returning an unsigned long fract.
 
static u88 rounduhk (u88 f, int n)
 This function rounds the input unsigned short accum to a number of bits, returning an unsigned short accum.
 
static u1616 rounduk (u1616 f, int n)
 This function rounds the input unsigned accum to a number of bits, returning an unsigned accum.
 
static u3232 roundulk (u3232 f, int n)
 This function rounds the input unsigned long accum to a number of bits, returning an unsigned long accum.
 
7.18a.6.4

The fixed-point countls functions

The integer return value of these functions is defined as follows:

  • if the value of the fixed-point argument f is non-zero, the return value is the largest integer k for which the expression f<<k does not overflow;
  • if the value of the fixed-point argument is zero, an integer value is returned that is at least as large as N, where N is the total number of value bits of the fixed-point type of the argument.
Note
if the value of the fixed-point argument is zero, the recommended return value is exactly N.
static int countlshr (s07 f)
 This function counts the number of leading sign-bits of a short fract.
 
static int countlsr (s015 f)
 This function counts the number of leading sign-bits of a fract.
 
static int countlslr (s031 f)
 This function counts the number of leading sign-bits of a long fract.
 
static int countlshk (s87 f)
 This function counts the number of leading sign-bits of a short accum.
 
static int countlsk (s1615 f)
 This function counts the number of leading sign-bits of an accum.
 
static int countlslk (s3231 f)
 This function counts the number of leading sign-bits of a long accum.
 
static int countlsuhr (u08 f)
 This function counts the number of leading zeros of an unsigned short fract.
 
static int countlsur (u016 f)
 This function counts the number of leading zeros of an unsigned fract.
 
static int countlsulr (u032 f)
 This function counts the number of leading zeros of an unsigned long fract.
 
static int countlsuhk (u88 f)
 This function counts the number of leading zeros of an unsigned short accum.
 
static int countlsuk (u1616 f)
 This function counts the number of leading zeros of an unsigned accum.
 
static int countlsulk (u3232 f)
 This function counts the number of leading zeros of an unsigned long accum.
 

Detailed Description

Additions to the stdfix.h file to support full Draft ISO/IEC standards compliance.

Author
Dave Lester (david.nosp@m..r.l.nosp@m.ester.nosp@m.@man.nosp@m.chest.nosp@m.er.a.nosp@m.c.uk)
Date
12 December, 2013

Macro Definition Documentation

◆ min

#define min (   a,
 
)    (((a)<(b)) ? (a) : (b))

Returns the minimum of two arguments.

Parameters
[in]aFirst argument
[in]bSecond argument
Returns
The minimum of a and b.

◆ __stdfix_max

#define __stdfix_max (   a,
 
)     (((a)<(b)) ? (b) : (a))

Returns the maximum of two arguments.

Parameters
[in]aFirst argument
[in]bSecond argument
Returns
The maximum of a and b.

◆ __stdfix_use

#define __stdfix_use (   a)     do {} while ((a)!=(a))

A macro definition which pretends to use variable a.

Parameters
[in]aFirst argument (must not be floating point!)

◆ __stdfix_abs

#define __stdfix_abs (   a)     (((a)<0) ? -(a) : (a))

Returns the absolute value of its argument.

Parameters
[in]aFirst argument.
Returns
The absolute value of a.

◆ __stdfix_ms_u32

#define __stdfix_ms_u32 (   x)     ((x) >> 32)

Returns the most significant 32-bits of a 64-bit argument.

Parameters
[in]xA 64-bit value.
Returns
The most significant 32-bits of x.

◆ __stdfix_ls_u32

#define __stdfix_ls_u32 (   x)     ((x) & UINT32_MAX)

Returns the least significant 32-bits of a 64-bit argument.

Parameters
[in]xA 64-bit value.
Returns
The least significant 32-bits of x.

◆ absfx

#define absfx (   f)
Value:
_Generic((f), \
s07: abshr(f), \
s015: absr(f), \
s031: abslr(f), \
s87: abshk(f), \
s1615: absk(f), \
s3231: abslk(f), \
default: abort() \
)
#define abort(n)
This macro is intended to mimic the behaviour of 'C's exit system call.
Definition assert.h:98
short fract s07
An alternative name for the signed short fract type.
Definition stdfix-full-iso.h:172
long accum s3231
An alternative name for the signed long accum type.
Definition stdfix-full-iso.h:187
fract s015
An alternative name for the signed fract type.
Definition stdfix-full-iso.h:175
static s1615 absk(s1615 f)
This function returns the absolute value of an accum.
Definition stdfix-full-iso.h:1745
static s3231 abslk(s3231 f)
This function returns the absolute value of a long accum.
Definition stdfix-full-iso.h:1761
static s87 abshk(s87 f)
This function returns the absolute value of a short accum.
Definition stdfix-full-iso.h:1729
static s031 abslr(s031 f)
This function returns the absolute value of a long fract.
Definition stdfix-full-iso.h:1713
long fract s031
An alternative name for the signed long fract type.
Definition stdfix-full-iso.h:178
short accum s87
An alternative name for the signed short accum type.
Definition stdfix-full-iso.h:181
accum s1615
An alternative name for the signed accum type.
Definition stdfix-full-iso.h:184
static s015 absr(s015 f)
This function returns the absolute value of a fract.
Definition stdfix-full-iso.h:1697
static s07 abshr(s07 f)
This function returns the absolute value of a short fract.
Definition stdfix-full-iso.h:1681

This macro provides type-generic access to the absolute value functions.

Parameters
[in]fA signed fixed-point value.
Returns
The absolute value of f (with the same type as f).

◆ roundfx

#define roundfx (   f,
 
)
Value:
_Generic((f), \
s07: roundhr(f, n), \
s015: roundr(f, n), \
s031: roundlr(f, n), \
s87: roundhk(f, n), \
s1615: roundk(f, n), \
s3231: roundlk(f, n), \
u08: rounduhr(f, n), \
u016: roundur(f, n), \
u032: roundulr(f, n), \
u88: rounduhk(f, n), \
u1616: rounduk(f, n), \
u3232: roundulk(f, n), \
default: abort() \
)
static u3232 roundulk(u3232 f, int n)
This function rounds the input unsigned long accum to a number of bits, returning an unsigned long ac...
Definition stdfix-full-iso.h:2091
static s07 roundhr(s07 f, int n)
This function rounds the input short fract to a number of bits, returning a short fract.
Definition stdfix-full-iso.h:1948
unsigned fract u016
An alternative name for the unsigned fract type.
Definition stdfix-full-iso.h:193
unsigned accum u1616
An alternative name for the unsigned accum type.
Definition stdfix-full-iso.h:202
static u016 roundur(u016 f, int n)
This function rounds the input unsigned fract to a number of bits, returning an unsigned fract.
Definition stdfix-full-iso.h:2039
static s015 roundr(s015 f, int n)
This function rounds the input fract to a number of bits, returning a fract.
Definition stdfix-full-iso.h:1961
static u08 rounduhr(u08 f, int n)
This function rounds the input unsigned short fract to a number of bits, returning an unsigned short ...
Definition stdfix-full-iso.h:2026
static s3231 roundlk(s3231 f, int n)
This function rounds the input long accum to a number of bits, returning a long accum.
Definition stdfix-full-iso.h:2013
unsigned short fract u08
An alternative name for the unsigned short fract type.
Definition stdfix-full-iso.h:190
static s031 roundlr(s031 f, int n)
This function rounds the input long fract to a number of bits, returning a long fract.
Definition stdfix-full-iso.h:1974
static u88 rounduhk(u88 f, int n)
This function rounds the input unsigned short accum to a number of bits, returning an unsigned short ...
Definition stdfix-full-iso.h:2065
static u032 roundulr(u032 f, int n)
This function rounds the input unsigned long fract to a number of bits, returning an unsigned long fr...
Definition stdfix-full-iso.h:2052
static s87 roundhk(s87 f, int n)
This function rounds the input short accum to a number of bits, returning a short accum.
Definition stdfix-full-iso.h:1987
static u1616 rounduk(u1616 f, int n)
This function rounds the input unsigned accum to a number of bits, returning an unsigned accum.
Definition stdfix-full-iso.h:2078
unsigned short accum u88
An alternative name for the unsigned short accum type.
Definition stdfix-full-iso.h:199
unsigned long fract u032
An alternative name for the unsigned long fract type.
Definition stdfix-full-iso.h:196
unsigned long accum u3232
An alternative name for the unsigned long accum type.
Definition stdfix-full-iso.h:205
static s1615 roundk(s1615 f, int n)
This function rounds the input accum to a number of bits, returning an accum.
Definition stdfix-full-iso.h:2000

This macro provides type-generic access to the rounding functions.

Parameters
[in]fA fixed-point value.
[in]nThe number of bits to be rounded off.
Returns
The rounded value of f (with the same type as f).

◆ countlsfx

#define countlsfx (   f)
Value:
_Generic((f), \
s07: countlshr(f), \
s015: countlsr(f), \
s031: countlslr(f), \
s87: countlshk(f), \
s1615: countlsk(f), \
u08: countlsuhr(f), \
u016: countlsur(f), \
u88: countlsuhk(f), \
default: abort() \
)
static int countlsuhr(u08 f)
This function counts the number of leading zeros of an unsigned short fract.
Definition stdfix-full-iso.h:2220
static int countlsulr(u032 f)
This function counts the number of leading zeros of an unsigned long fract.
Definition stdfix-full-iso.h:2254
static int countlsuk(u1616 f)
This function counts the number of leading zeros of an unsigned accum.
Definition stdfix-full-iso.h:2288
static int countlsk(s1615 f)
This function counts the number of leading sign-bits of an accum.
Definition stdfix-full-iso.h:2186
static int countlsur(u016 f)
This function counts the number of leading zeros of an unsigned fract.
Definition stdfix-full-iso.h:2237
static int countlsr(s015 f)
This function counts the number of leading sign-bits of a fract.
Definition stdfix-full-iso.h:2136
static int countlshr(s07 f)
This function counts the number of leading sign-bits of a short fract.
Definition stdfix-full-iso.h:2120
static int countlslr(s031 f)
This function counts the number of leading sign-bits of a long fract.
Definition stdfix-full-iso.h:2153
static int countlshk(s87 f)
This function counts the number of leading sign-bits of a short accum.
Definition stdfix-full-iso.h:2170
static int countlsulk(u3232 f)
This function counts the number of leading zeros of an unsigned long accum.
Definition stdfix-full-iso.h:2305
static int countlsuhk(u88 f)
This function counts the number of leading zeros of an unsigned short accum.
Definition stdfix-full-iso.h:2271
static int countlslk(s3231 f)
This function counts the number of leading sign-bits of a long accum.
Definition stdfix-full-iso.h:2203

This macro provides type-generic access to the functions for counting leading sign-bits.

Parameters
[in]fA fixed-point value.
Returns
The number of leading sign-bits in f.

Function Documentation

◆ __stdfix_64x64_128()

void __stdfix_64x64_128 ( uint64_t *  hi,
uint64_t *  lo,
uint64_t  x,
uint64_t  y 
)

Multiplies two 64-bit unsigned integers returning a 128-bit result in hi and lo.

Parameters
[out]hiThe high 64 bits of the product
[out]loThe low 64 bits of the product
[in]xFirst argument
[in]ySecond argument

◆ bitshr()

static int_hr_t bitshr ( const s07  f)
inlinestatic

Converts a short fract into an integer.

Parameters
[in]fA short fract
Returns
The integer representation.

◆ bitsr()

static int_r_t bitsr ( const s015  f)
inlinestatic

Converts a fract into an integer.

Parameters
[in]fA fract
Returns
The integer representation.

◆ bitslr()

static int_lr_t bitslr ( const s031  f)
inlinestatic

Converts a long fract into an integer.

Parameters
[in]fA long fract
Returns
The integer representation.

◆ bitshk()

static int_hk_t bitshk ( const s87  f)
inlinestatic

Converts a short accum into an integer.

Parameters
[in]fA short accum
Returns
The integer representation.

◆ bitsk()

static int_k_t bitsk ( const s1615  f)
inlinestatic

Converts an accum into an integer.

Parameters
[in]fAn accum
Returns
The integer representation.

◆ bitslk()

static int_lk_t bitslk ( const s3231  f)
inlinestatic

Converts a long accum into an integer.

Parameters
[in]fA long accum
Returns
The integer representation.

◆ bitsuhr()

static uint_uhr_t bitsuhr ( const u08  f)
inlinestatic

Converts an unsigned short fract into an integer.

Parameters
[in]fAn unsigned short fract
Returns
The integer representation.

◆ bitsur()

static uint_ur_t bitsur ( const u016  f)
inlinestatic

Converts an unsigned fract into an integer.

Parameters
[in]fAn unsigned fract
Returns
The integer representation.

◆ bitsulr()

static uint_ulr_t bitsulr ( const u032  f)
inlinestatic

Converts an unsigned long fract into an integer.

Parameters
[in]fAn unsigned long fract
Returns
The integer representation.

◆ bitsuhk()

static uint_uhk_t bitsuhk ( const u88  f)
inlinestatic

Converts an unsigned short accum into an integer.

Parameters
[in]fAn unsigned short accum
Returns
The integer representation.

◆ bitsuk()

static uint_uk_t bitsuk ( const u1616  f)
inlinestatic

Converts an unsigned accum into an integer.

Parameters
[in]fAn unsigned accum
Returns
The integer representation.

◆ bitsulk()

static uint_ulk_t bitsulk ( const u3232  f)
inlinestatic

Converts an unsigned long accum into an integer.

Parameters
[in]fAn unsigned long accum
Returns
The integer representation.

◆ hrbits()

static s07 hrbits ( const int_hr_t  n)
inlinestatic

Converts a signed integer into a signed short fract.

Parameters
[in]nA signed integer
Returns
The signed short fract represented by n.

◆ rbits()

static s015 rbits ( const int_r_t  n)
inlinestatic

Converts a signed integer into a signed fract.

Parameters
[in]nA signed integer
Returns
The signed fract represented by n.

◆ lrbits()

static s031 lrbits ( const int_lr_t  n)
inlinestatic

Converts a signed integer into a signed long fract.

Parameters
[in]nA signed integer
Returns
The signed long fract represented by n.

◆ hkbits()

static s87 hkbits ( const int_hk_t  n)
inlinestatic

Converts a signed integer into a signed short accum.

Parameters
[in]nA signed integer
Returns
The signed short accum represented by n.

◆ kbits()

static s1615 kbits ( const int_k_t  n)
inlinestatic

Converts a signed integer into a signed accum.

Parameters
[in]nA signed integer
Returns
The signed accum represented by n.

◆ lkbits()

static s3231 lkbits ( const int_lk_t  n)
inlinestatic

Converts a signed integer into a signed long accum.

Parameters
[in]nA signed integer
Returns
The signed long accum represented by n.

◆ uhrbits()

static u08 uhrbits ( const uint_uhr_t  n)
inlinestatic

Converts an unsigned integer into an unsigned short fract.

Parameters
[in]nAn unsigned integer
Returns
The unsigned short fract represented by n.

◆ urbits()

static u016 urbits ( const uint_ur_t  n)
inlinestatic

Converts an unsigned integer into an unsigned fract.

Parameters
[in]nAn unsigned integer
Returns
The unsigned fract represented by n.

◆ ulrbits()

static u032 ulrbits ( const uint_ulr_t  n)
inlinestatic

Converts an unsigned integer into an unsigned long fract.

Parameters
[in]nAn unsigned integer
Returns
The unsigned long fract represented by n.

◆ uhkbits()

static u88 uhkbits ( const uint_uhk_t  n)
inlinestatic

Converts an unsigned integer into an unsigned short accum.

Parameters
[in]nAn unsigned integer
Returns
The unsigned short accum represented by n.

◆ ukbits()

static u1616 ukbits ( const uint_uk_t  n)
inlinestatic

Converts an unsigned integer into an unsigned accum.

Parameters
[in]nAn unsigned integer
Returns
The unsigned accum represented by n.

◆ ulkbits()

static u3232 ulkbits ( const uint_ulk_t  n)
inlinestatic

Converts an unsigned integer into an unsigned long accum.

Parameters
[in]nAn unsigned integer
Returns
The unsigned long accum represented by n.

◆ __stdfix_sat_hr()

static int32_t __stdfix_sat_hr ( const int32_t  x)
inlinestatic

Saturates an integer to 8 bits.

Parameters
[in]xAn integer
Returns
The value of x saturated to 8 bits.

◆ __stdfix_sat_r()

static int32_t __stdfix_sat_r ( const int32_t  x)
inlinestatic

Saturates an integer to 16 bits.

Parameters
[in]xAn integer
Returns
The value of x saturated to 16 bits.

◆ __stdfix_sat_lr()

static int32_t __stdfix_sat_lr ( const int64_t  x)
inlinestatic

Saturates a 64-bit integer to 32-bits.

Parameters
[in]xAn integer
Returns
The value of x saturated to 32-bits.

◆ __stdfix_sat_hk()

static int32_t __stdfix_sat_hk ( const int32_t  x)
inlinestatic

Saturates an integer to 16 bits.

Parameters
[in]xAn integer
Returns
The value of x saturated to 16 bits.

◆ __stdfix_sat_k()

static int32_t __stdfix_sat_k ( const int64_t  x)
inlinestatic

Saturates a 64-bit integer to 32-bits.

Parameters
[in]xAn integer
Returns
The value of x saturated to 32-bits.

◆ __stdfix_sat_uhr()

static uint32_t __stdfix_sat_uhr ( const uint32_t  x)
inlinestatic

Saturates an unsigned integer to 8 bits.

Parameters
[in]xAn unsigned integer
Returns
The value of x saturated to 8 bits.

◆ __stdfix_sat_ur()

static uint32_t __stdfix_sat_ur ( const uint32_t  x)
inlinestatic

Saturates an unsigned integer to 16 bits.

Parameters
[in]xAn unsigned integer
Returns
The value of x saturated to 16 bits.

◆ __stdfix_sat_ulr()

static uint32_t __stdfix_sat_ulr ( const uint64_t  x)
inlinestatic

Saturates an unsigned 64-bit integer to 32 bits.

Parameters
[in]xAn unsigned integer
Returns
The value of x saturated to 32 bits.

◆ __stdfix_sat_uhk()

static uint32_t __stdfix_sat_uhk ( const uint32_t  x)
inlinestatic

Saturates an unsigned integer to 16 bits.

Parameters
[in]xAn unsigned integer
Returns
The value of x saturated to 16 bits.

◆ __stdfix_sat_uk()

static uint32_t __stdfix_sat_uk ( const uint64_t  x)
inlinestatic

Saturates an unsigned 64-bit integer to 32 bits.

Parameters
[in]xAn unsigned integer
Returns
The value of x saturated to 32 bits.

◆ __stdfix_sadd_hr()

static int32_t __stdfix_sadd_hr ( int_hr_t  x,
int_hr_t  y 
)
inlinestatic

Saturated addition of the underlying integer representations.

Parameters
[in]xAn 8-bit integer
[in]yAn 8-bit integer
Returns
The value of x+y saturated to 8 bits.

◆ __stdfix_ssub_hr()

static int32_t __stdfix_ssub_hr ( int_hr_t  x,
int_hr_t  y 
)
inlinestatic

Saturated subtraction of the underlying integer representations.

Parameters
[in]xAn 8-bit integer
[in]yAn 8-bit integer
Returns
The value of x-y saturated to 8 bits.

◆ __stdfix_sneg_hr()

static int32_t __stdfix_sneg_hr ( int_hr_t  x)
inlinestatic

Saturated negation of the underlying integer representations.

Parameters
[in]xAn 8-bit integer
Returns
The value of -x saturated to 8 bits.

◆ __stdfix_sadd_r()

static int32_t __stdfix_sadd_r ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated addition of the underlying integer representations.

Parameters
[in]xA 16-bit integer
[in]yA 16-bit integer
Returns
The value of x+y saturated to 16 bits.

◆ __stdfix_ssub_r()

static int32_t __stdfix_ssub_r ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated subtraction of the underlying integer representations.

Parameters
[in]xA 16-bit integer
[in]yA 16-bit integer
Returns
The value of x-y saturated to 16 bits.

◆ __stdfix_sneg_r()

static int32_t __stdfix_sneg_r ( int32_t  x)
inlinestatic

Saturated negation of the underlying integer representations.

Parameters
[in]xA 16-bit integer
Returns
The value of -x saturated to 16 bits.

◆ __stdfix_sadd_lr()

static int32_t __stdfix_sadd_lr ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated addition of the underlying integer representations.

Parameters
[in]xA 32-bit integer
[in]yA 32-bit integer
Returns
The value of x+y saturated to 32 bits.

◆ __stdfix_ssub_lr()

static int32_t __stdfix_ssub_lr ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated subtraction of the underlying integer representations.

Parameters
[in]xA 32-bit integer
[in]yA 32-bit integer
Returns
The value of x-y saturated to 32 bits.

◆ __stdfix_sneg_lr()

static int32_t __stdfix_sneg_lr ( int32_t  x)
inlinestatic

Saturated negation of the underlying integer representations.

Parameters
[in]xA 32-bit integer
Returns
The value of -x saturated to 32 bits.

◆ __stdfix_sadd_hk()

static int32_t __stdfix_sadd_hk ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated addition of the underlying integer representations.

Parameters
[in]xA 16-bit integer
[in]yA 16-bit integer
Returns
The value of x+y saturated to 16 bits.

◆ __stdfix_ssub_hk()

static int32_t __stdfix_ssub_hk ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated subtraction of the underlying integer representations.

Parameters
[in]xA 16-bit integer
[in]yA 16-bit integer
Returns
The value of x-y saturated to 16 bits.

◆ __stdfix_sneg_hk()

static int32_t __stdfix_sneg_hk ( int32_t  x)
inlinestatic

Saturated negation of the underlying integer representations.

Parameters
[in]xA 16-bit integer
Returns
The value of -x saturated to 16 bits.

◆ __stdfix_sadd_k()

static int32_t __stdfix_sadd_k ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated addition of the underlying integer representations.

Parameters
[in]xA 32-bit integer
[in]yA 32-bit integer
Returns
The value of x+y saturated to 32 bits.

◆ __stdfix_ssub_k()

static int32_t __stdfix_ssub_k ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated subtraction of the underlying integer representations.

Parameters
[in]xA 32-bit integer
[in]yA 32-bit integer
Returns
The value of x-y saturated to 32 bits.

◆ __stdfix_sneg_k()

static int32_t __stdfix_sneg_k ( int32_t  x)
inlinestatic

Saturated negation of the underlying integer representations.

Parameters
[in]xA 32-bit integer
Returns
The value of -x saturated to 32 bits.

◆ __stdfix_sadd_lk()

int64_t __stdfix_sadd_lk ( int64_t  x,
int64_t  y 
)

Saturated addition of the underlying integer representations.

Parameters
[in]xA 64-bit integer
[in]yA 64-bit integer
Returns
The value of x+y saturated to 64 bits.

◆ __stdfix_ssub_lk()

int64_t __stdfix_ssub_lk ( int64_t  x,
int64_t  y 
)

Saturated subtraction of the underlying integer representations.

Parameters
[in]xA 64-bit integer
[in]yA 64-bit integer
Returns
The value of x-y saturated to 64 bits.

◆ __stdfix_sneg_lk()

int64_t __stdfix_sneg_lk ( int64_t  x)

Saturated negation of the underlying integer representations.

Parameters
[in]xA 64-bit integer
Returns
The value of -x saturated to 64 bits.

◆ __stdfix_smul_hr()

static int32_t __stdfix_smul_hr ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 32-bit integer representing of a short fract.
[in]yA 32-bit integer representing of a short fract.
Returns
The value of x*y saturated to 8 bits representing of a short fract.

◆ __stdfix_smul_r()

static int32_t __stdfix_smul_r ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 32-bit integer representing of a fract.
[in]yA 32-bit integer representing of a fract.
Returns
The value of x*y saturated to 16 bits representing of a fract.

◆ __stdfix_smul_lr()

static int32_t __stdfix_smul_lr ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 32-bit integer representing of a long fract.
[in]yA 32-bit integer representing of a long fract.
Returns
The value of x*y saturated to 32 bits representing of a long fract.

◆ __stdfix_smul_hk()

static int32_t __stdfix_smul_hk ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 32-bit integer representing of a short accum.
[in]yA 32-bit integer representing of a short accum.
Returns
The value of x*y saturated to 16 bits representing of a short accum.

◆ __stdfix_smul_k()

static int32_t __stdfix_smul_k ( int32_t  x,
int32_t  y 
)
inlinestatic

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 32-bit integer representing of an accum.
[in]yA 32-bit integer representing of an accum.
Returns
The value of x*y saturated to 32 bits representing of an accum.

◆ __stdfix_smul_lk()

int64_t __stdfix_smul_lk ( int64_t  x,
int64_t  y 
)

Saturated multiplication of the underlying integer representations.

Parameters
[in]xA 64-bit integer representing of a long accum.
[in]yA 64-bit integer representing of a long accum.
Returns
The value of x*y saturated to 64 bits representing of a long accum.

◆ __stdfix_sadd_uhr()

static uint32_t __stdfix_sadd_uhr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x+y saturated to 8 bits.

◆ __stdfix_ssub_uhr()

static uint32_t __stdfix_ssub_uhr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x-y saturated to 8 bits.

◆ __stdfix_sadd_ur()

static uint32_t __stdfix_sadd_ur ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x+y saturated to 16 bits.

◆ __stdfix_ssub_ur()

static uint32_t __stdfix_ssub_ur ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x-y saturated to 16 bits.

◆ __stdfix_sadd_ulr()

static uint32_t __stdfix_sadd_ulr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x+y saturated to 32 bits.

◆ __stdfix_ssub_ulr()

static uint32_t __stdfix_ssub_ulr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x-y saturated to 32 bits.

◆ __stdfix_sadd_uhk()

static uint32_t __stdfix_sadd_uhk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x+y saturated to 16 bits.

◆ __stdfix_ssub_uhk()

static uint32_t __stdfix_ssub_uhk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x-y saturated to 16 bits.

◆ __stdfix_sadd_uk()

static uint32_t __stdfix_sadd_uk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x+y saturated to 32 bits.

◆ __stdfix_ssub_uk()

static uint32_t __stdfix_ssub_uk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer
[in]yA 32-bit unsigned integer
Returns
The value of x-y saturated to 32 bits.

◆ __stdfix_sadd_ulk()

uint64_t __stdfix_sadd_ulk ( uint64_t  x,
uint64_t  y 
)

Saturated addition of the underlying unsigned integer representations.

Parameters
[in]xA 64-bit unsigned integer
[in]yA 64-bit unsigned integer
Returns
The value of x+y saturated to 64 bits.

◆ __stdfix_ssub_ulk()

uint64_t __stdfix_ssub_ulk ( uint64_t  x,
uint64_t  y 
)

Saturated subtraction of the underlying unsigned integer representations.

Parameters
[in]xA 64-bit unsigned integer
[in]yA 64-bit unsigned integer
Returns
The value of x-y saturated to 64 bits.

◆ __stdfix_smul_uhr()

static uint32_t __stdfix_smul_uhr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer representing of an unsigned short fract.
[in]yA 32-bit unsigned integer representing of an unsigned short fract.
Returns
The value of x*y saturated to 8 bits representing of an unsigned short fract.

◆ __stdfix_smul_ur()

static uint32_t __stdfix_smul_ur ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer representing of an unsigned fract.
[in]yA 32-bit unsigned integer representing of an unsigned fract.
Returns
The value of x*y saturated to 16 bits representing of an unsigned fract.

◆ __stdfix_smul_ulr()

static uint32_t __stdfix_smul_ulr ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer representing of an unsigned long fract.
[in]yA 32-bit unsigned integer representing of an unsigned long fract.
Returns
The value of x*y saturated to 32 bits representing of an unsigned long fract.

◆ __stdfix_smul_uhk()

static uint32_t __stdfix_smul_uhk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer representing of an unsigned short accum.
[in]yA 32-bit unsigned integer representing of an unsigned short accum.
Returns
The value of x*y saturated to 16 bits representing of an unsigned short accum.

◆ __stdfix_smul_uk()

static uint32_t __stdfix_smul_uk ( uint32_t  x,
uint32_t  y 
)
inlinestatic

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 32-bit unsigned integer representing of an unsigned accum.
[in]yA 32-bit unsigned integer representing of an unsigned accum.
Returns
The value of x*y saturated to 32 bits representing of an unsigned accum.

◆ __stdfix_smul_ulk()

uint64_t __stdfix_smul_ulk ( uint64_t  x,
uint64_t  y 
)

Saturated multiplication of the underlying unsigned integer representations.

Parameters
[in]xA 64-bit unsigned integer representing of an unsigned long accum.
[in]yA 64-bit unsigned integer representing of an unsigned long accum.
Returns
The value of x*y saturated to 64 bits representing of an unsigned long accum.

◆ mulir()

static int mulir ( int  n,
s015  x 
)
inlinestatic

Multiplies an integer by a fract giving an integer answer.

Parameters
[in]nAn integer
[in]xAn s0.15 fract
Returns
The integer part of n*x.

◆ mulilr()

static long int mulilr ( long int  n,
s031  x 
)
inlinestatic

Multiplies a long integer by a long fract giving an integer answer.

Parameters
[in]nA long integer
[in]xAn s0.31 fract
Returns
The integer part of n*x.

◆ mulik()

static int mulik ( int  n,
s1615  x 
)
inlinestatic

Multiplies an integer by an accum giving an integer answer.

Parameters
[in]nAn integer
[in]xAn s16.15 accum
Returns
The integer part of n*x.

◆ mulilk()

static long int mulilk ( long int  n,
s3231  x 
)
inlinestatic

Multiplies a long integer by a long accum giving a long integer answer.

Parameters
[in]nA long integer
[in]xAn s32.31 accum
Returns
The integer part of n*x.

◆ divir()

static int divir ( int  n,
s015  x 
)
inlinestatic

Divides an integer by a fract giving an integer answer.

Parameters
[in]nAn integer
[in]xAn s0.15 fract
Returns
The integer part of n/x.

◆ divilr()

static long int divilr ( long int  n,
s031  x 
)
inlinestatic

Divides a long integer by a long fract giving a long integer answer.

Parameters
[in]nA long integer
[in]xAn s0.31 fract
Returns
The integer part of n/x.

◆ divik()

static int divik ( int  n,
s1615  x 
)
inlinestatic

Divides an integer by an accum giving an integer answer.

Parameters
[in]nAn integer
[in]xAn s16.15 accum
Returns
The integer part of n/x.

◆ divilk()

static long int divilk ( long int  n,
s3231  x 
)
inlinestatic

Divides an integer by a long accum giving a long integer answer.

Parameters
[in]nA long integer
[in]xAn s32.31 accum
Returns
The integer part of n/x.

◆ rdivi()

static s015 rdivi ( int  i,
int  j 
)
inlinestatic

Divides two integers giving a fract answer.

Parameters
[in]iAn integer
[in]jAn integer
Returns
a fract representing i/j.

◆ lrdivi()

static s031 lrdivi ( long int  i,
long int  j 
)
inlinestatic

Divides two integers giving a long fract answer.

Parameters
[in]iAn integer
[in]jAn integer
Returns
a long fract representing i/j.

◆ kdivi()

static s1615 kdivi ( int  i,
int  j 
)
inlinestatic

Divides two integers giving an accum answer.

Parameters
[in]iAn integer
[in]jAn integer
Returns
an accum representing i/j.

◆ lkdivi()

static s3231 lkdivi ( long int  i,
long int  j 
)
inlinestatic

Divides two integers giving a long accum answer.

Parameters
[in]iAn integer
[in]jAn integer
Returns
a long accum representing i/j.

◆ idivr()

static int idivr ( s015  x,
s015  y 
)
inlinestatic

Divides two fracts giving an integer answer.

Parameters
[in]xA fract
[in]yA fract
Returns
An integer representing the integer part of x/y.

◆ idivlr()

static long int idivlr ( s031  x,
s031  y 
)
inlinestatic

Divides two long fracts giving a long integer answer.

Parameters
[in]xA long fract
[in]yA long fract
Returns
A long integer representing the integer part of x/y.

◆ idivk()

static int idivk ( s1615  x,
s1615  y 
)
inlinestatic

Divides two accums giving an integer answer.

Parameters
[in]xAn accum
[in]yAn accum
Returns
An integer representing the integer part of x/y.

◆ idivlk()

static long int idivlk ( s3231  x,
s3231  y 
)
inlinestatic

Divides two long accums giving a long integer answer.

Parameters
[in]xA long accum
[in]yA long accum
Returns
A long integer representing the integer part of x/y.

◆ muliur()

static unsigned int muliur ( unsigned int  n,
u016  x 
)
inlinestatic

Multiplies an unsigned integer by an unsigned fract giving an unsigned integer answer.

Parameters
[in]nAn unsigned integer
[in]xAn unsigned fract
Returns
An unsigned integer representing the integer part of n*x.

◆ muliulr()

static unsigned long int muliulr ( unsigned long int  n,
u032  x 
)
inlinestatic

Multiplies an unsigned long integer by an unsigned long fract giving an unsigned integer answer.

Parameters
[in]nAn unsigned long integer
[in]xAn unsigned long fract
Returns
An unsigned long integer representing the integer part of n*x.

◆ muliuk()

static unsigned int muliuk ( unsigned int  n,
u1616  x 
)
inlinestatic

Multiplies an unsigned integer by an unsigned accum giving an unsigned integer answer.

Parameters
[in]nAn unsigned integer
[in]xAn unsigned accum
Returns
An unsigned integer representing the integer part of n*x.

◆ muliulk()

static unsigned long int muliulk ( unsigned long int  n,
u3232  x 
)
inlinestatic

Multiplies an unsigned long integer by an unsigned long accum giving an unsigned long integer answer.

Parameters
[in]nAn unsigned long integer
[in]xAn unsigned long accum
Returns
An unsigned long integer representing the integer part of n*x.

◆ diviur()

static unsigned int diviur ( unsigned int  n,
u016  x 
)
inlinestatic

Divides an unsigned integer by an unsigned fract giving an unsigned integer answer.

Parameters
[in]nAn unsigned integer
[in]xAn unsigned fract
Returns
An unsigned integer representing the integer part of n/x.

◆ diviulr()

static unsigned long int diviulr ( unsigned long int  n,
u032  x 
)
inlinestatic

Divides a long unsigned integer by a long unsigned fract giving an unsigned integer answer.

Parameters
[in]nA long unsigned integer
[in]xA long unsigned fract
Returns
A long unsigned integer representing the integer part of n/x.

◆ diviuk()

static unsigned int diviuk ( unsigned int  n,
u1616  x 
)
inlinestatic

Divides an unsigned integer by an unsigned accum giving an unsigned integer answer.

Parameters
[in]nAn unsigned integer
[in]xAn unsigned accum
Returns
An unsigned integer representing the integer part of n/x.

◆ diviulk()

static unsigned long int diviulk ( unsigned long int  n,
u3232  x 
)
inlinestatic

Divides a long unsigned integer by a long unsigned accum giving an unsigned integer answer.

Parameters
[in]nA long unsigned integer
[in]xA long unsigned accum
Returns
A long unsigned integer representing the integer part of n/x.

◆ urdivi()

static u016 urdivi ( unsigned int  i,
unsigned int  j 
)
inlinestatic

Divides two unsigned integers giving an unsigned fract answer.

Parameters
[in]iAn unsigned integer
[in]jAn unsigned integer
Returns
An unsigned fract representing i/j.

◆ ulrdivi()

static u032 ulrdivi ( unsigned long int  i,
unsigned long int  j 
)
inlinestatic

Divides two unsigned long integers giving an unsigned long fract answer.

Parameters
[in]iAn unsigned long integer
[in]jAn unsigned long integer
Returns
An unsigned long fract representing i/j.

◆ ukdivi()

static u1616 ukdivi ( unsigned int  i,
unsigned int  j 
)
inlinestatic

Divides two unsigned integers giving an unsigned accum answer.

Parameters
[in]iAn unsigned integer
[in]jAn unsigned integer
Returns
An unsigned accum representing i/j.

◆ ulkdivi()

static u3232 ulkdivi ( unsigned long int  i,
unsigned long int  j 
)
inlinestatic

Divides two unsigned long integers giving an unsigned long accum answer.

Parameters
[in]iAn unsigned long integer
[in]jAn unsigned long integer
Returns
An unsigned long accum representing i/j.

◆ idivur()

static unsigned int idivur ( u016  x,
u016  y 
)
inlinestatic

Divides two unsigned fracts giving an unsigned integer answer.

Parameters
[in]xAn unsigned fract
[in]yAn unsigned fract
Returns
An unsigned integer representing the integer part of x/y.

◆ idivulr()

static unsigned long int idivulr ( u032  x,
u032  y 
)
inlinestatic

Divides two unsigned long fracts giving an unsigned long integer answer.

Parameters
[in]xAn unsigned long fract
[in]yAn unsigned long fract
Returns
An unsigned long integer representing the integer part of x/y.

◆ idivuk()

static unsigned int idivuk ( u1616  x,
u1616  y 
)
inlinestatic

Divides two unsigned accums giving an unsigned integer answer.

Parameters
[in]xAn unsigned accum
[in]yAn unsigned accum
Returns
An unsigned integer representing the integer part of x/y.

◆ idivulk()

static unsigned long int idivulk ( u3232  x,
u3232  y 
)
inlinestatic

Divides two unsigned long accums giving an unsigned long integer answer.

Parameters
[in]xAn unsigned long accum
[in]yAn unsigned long accum
Returns
An unsigned long integer representing the integer part of x/y.

◆ abshr()

static s07 abshr ( s07  f)
inlinestatic

This function returns the absolute value of a short fract.

Parameters
[in]fA short fract.
Returns
The absolute value of f.

◆ absr()

static s015 absr ( s015  f)
inlinestatic

This function returns the absolute value of a fract.

Parameters
[in]fA fract.
Returns
The absolute value of f.

◆ abslr()

static s031 abslr ( s031  f)
inlinestatic

This function returns the absolute value of a long fract.

Parameters
[in]fA long fract.
Returns
The absolute value of f.

◆ abshk()

static s87 abshk ( s87  f)
inlinestatic

This function returns the absolute value of a short accum.

Parameters
[in]fA short accum.
Returns
The absolute value of f.

◆ absk()

static s1615 absk ( s1615  f)
inlinestatic

This function returns the absolute value of an accum.

Parameters
[in]fAn accum.
Returns
The absolute value of f.

◆ abslk()

static s3231 abslk ( s3231  f)
inlinestatic

This function returns the absolute value of a long accum.

Parameters
[in]fA long accum.
Returns
The absolute value of f.

◆ __stdfix_round_u8()

static uint8_t __stdfix_round_u8 ( uint8_t  x,
int  n 
)
inlinestatic

This function rounds the input unsigned 8-bit integer to a number of bits, returning an 8-bit integer.

Parameters
[in]xAn 8-bit number to be rounded.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ __stdfix_round_u16()

static uint16_t __stdfix_round_u16 ( uint16_t  x,
int  n 
)
inlinestatic

This function rounds the input unsigned 16-bit integer to a number of bits, returning a 16-bit integer.

Parameters
[in]xA 16-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_u32()

static uint32_t __stdfix_round_u32 ( uint32_t  x,
int  n 
)
inlinestatic

This function rounds the input unsigned 32-bit integer to a number of bits, returning a 32-bit integer.

Parameters
[in]xA 32-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_u64()

static uint64_t __stdfix_round_u64 ( uint64_t  x,
int  n 
)
inlinestatic

This function rounds the input unsigned 64-bit integer to a number of bits, returning a 64-bit integer.

Parameters
[in]xA 64-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_s8()

static int8_t __stdfix_round_s8 ( int8_t  x,
int  n 
)
inlinestatic

This function rounds the input signed 8-bit integer to a number of bits, returning an 8-bit integer.

Parameters
[in]xAn 8-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_s16()

static int16_t __stdfix_round_s16 ( int16_t  x,
int  n 
)
inlinestatic

This function rounds the input signed 16-bit integer to a number of bits, returning a 16-bit integer.

Parameters
[in]xA 16-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_s32()

static int32_t __stdfix_round_s32 ( int32_t  x,
int  n 
)
inlinestatic

This function rounds the input signed 32-bit integer to a number of bits, returning a 32-bit integer.

Parameters
[in]xA 32-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ __stdfix_round_s64()

static int64_t __stdfix_round_s64 ( int64_t  x,
int  n 
)
inlinestatic

This function rounds the input signed 64-bit integer to a number of bits, returning a 64-bit integer.

Parameters
[in]xA 64-bit number to be rounded.
[in]nAn int.
Returns
The x rounded to the nearest n bits.

◆ roundhr()

static s07 roundhr ( s07  f,
int  n 
)
inlinestatic

This function rounds the input short fract to a number of bits, returning a short fract.

Parameters
[in]fA short fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundr()

static s015 roundr ( s015  f,
int  n 
)
inlinestatic

This function rounds the input fract to a number of bits, returning a fract.

Parameters
[in]fA fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundlr()

static s031 roundlr ( s031  f,
int  n 
)
inlinestatic

This function rounds the input long fract to a number of bits, returning a long fract.

Parameters
[in]fA long fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundhk()

static s87 roundhk ( s87  f,
int  n 
)
inlinestatic

This function rounds the input short accum to a number of bits, returning a short accum.

Parameters
[in]fA short accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundk()

static s1615 roundk ( s1615  f,
int  n 
)
inlinestatic

This function rounds the input accum to a number of bits, returning an accum.

Parameters
[in]fAn accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundlk()

static s3231 roundlk ( s3231  f,
int  n 
)
inlinestatic

This function rounds the input long accum to a number of bits, returning a long accum.

Parameters
[in]fA long accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ rounduhr()

static u08 rounduhr ( u08  f,
int  n 
)
inlinestatic

This function rounds the input unsigned short fract to a number of bits, returning an unsigned short fract.

Parameters
[in]fAn unsigned short fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundur()

static u016 roundur ( u016  f,
int  n 
)
inlinestatic

This function rounds the input unsigned fract to a number of bits, returning an unsigned fract.

Parameters
[in]fAn unsigned fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundulr()

static u032 roundulr ( u032  f,
int  n 
)
inlinestatic

This function rounds the input unsigned long fract to a number of bits, returning an unsigned long fract.

Parameters
[in]fAn unsigned long fract.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ rounduhk()

static u88 rounduhk ( u88  f,
int  n 
)
inlinestatic

This function rounds the input unsigned short accum to a number of bits, returning an unsigned short accum.

Parameters
[in]fAn unsigned short accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ rounduk()

static u1616 rounduk ( u1616  f,
int  n 
)
inlinestatic

This function rounds the input unsigned accum to a number of bits, returning an unsigned accum.

Parameters
[in]fAn unsigned accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ roundulk()

static u3232 roundulk ( u3232  f,
int  n 
)
inlinestatic

This function rounds the input unsigned long accum to a number of bits, returning an unsigned long accum.

Parameters
[in]fAn unsigned long accum.
[in]nAn int.
Returns
The f rounded to the nearest n bits.

◆ countlshr()

static int countlshr ( s07  f)
inlinestatic

This function counts the number of leading sign-bits of a short fract.

Parameters
[in]fA short fract.
Returns
The number of leading sign-bits in f.

◆ countlsr()

static int countlsr ( s015  f)
inlinestatic

This function counts the number of leading sign-bits of a fract.

Parameters
[in]fA fract.
Returns
The number of leading sign-bits in f.

◆ countlslr()

static int countlslr ( s031  f)
inlinestatic

This function counts the number of leading sign-bits of a long fract.

Parameters
[in]fA long fract.
Returns
The number of leading sign-bits in f.

◆ countlshk()

static int countlshk ( s87  f)
inlinestatic

This function counts the number of leading sign-bits of a short accum.

Parameters
[in]fA short accum.
Returns
The number of leading sign-bits in f.

◆ countlsk()

static int countlsk ( s1615  f)
inlinestatic

This function counts the number of leading sign-bits of an accum.

Parameters
[in]fAn accum.
Returns
The number of leading sign-bits in f.

◆ countlslk()

static int countlslk ( s3231  f)
inlinestatic

This function counts the number of leading sign-bits of a long accum.

Parameters
[in]fA long accum.
Returns
The number of leading sign-bits in f.

◆ countlsuhr()

static int countlsuhr ( u08  f)
inlinestatic

This function counts the number of leading zeros of an unsigned short fract.

Parameters
[in]fAn unsigned short fract.
Returns
The number of leading zeros in f.

◆ countlsur()

static int countlsur ( u016  f)
inlinestatic

This function counts the number of leading zeros of an unsigned fract.

Parameters
[in]fAn unsigned fract.
Returns
The number of leading zeros in f.

◆ countlsulr()

static int countlsulr ( u032  f)
inlinestatic

This function counts the number of leading zeros of an unsigned long fract.

Parameters
[in]fAn unsigned long fract.
Returns
The number of leading zeros in f.

◆ countlsuhk()

static int countlsuhk ( u88  f)
inlinestatic

This function counts the number of leading zeros of an unsigned short accum.

Parameters
[in]fAn unsigned short accum.
Returns
The number of leading zeros in f.

◆ countlsuk()

static int countlsuk ( u1616  f)
inlinestatic

This function counts the number of leading zeros of an unsigned accum.

Parameters
[in]fAn unsigned accum.
Returns
The number of leading zeros in f.

◆ countlsulk()

static int countlsulk ( u3232  f)
inlinestatic

This function counts the number of leading zeros of an unsigned long accum.

Parameters
[in]fAn unsigned long accum.
Returns
The number of leading zeros in f.