Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
Checked Integer Casting

Bounds-checked conversion between fixed-width types (ADR-003). More...

Files

file  src/utils/cast/sapi_cast.c
 Generated from ADR-003's template; see sapi_cast.h for behavior. Every function widens its input to the int64_t/uint64_t matching the source's signedness, then range-checks against the destination's limit macros before performing the explicit cast.

Functions

sapi_status_t sapi_cast_i8_to_i16 (int8_t in, int16_t *out)
 Checked cast from int8_t to int16_t.
sapi_status_t sapi_cast_i8_to_i32 (int8_t in, int32_t *out)
 Checked cast from int8_t to int32_t.
sapi_status_t sapi_cast_i8_to_i64 (int8_t in, int64_t *out)
 Checked cast from int8_t to int64_t.
sapi_status_t sapi_cast_i8_to_u8 (int8_t in, uint8_t *out)
 Checked cast from int8_t to uint8_t.
sapi_status_t sapi_cast_i8_to_u16 (int8_t in, uint16_t *out)
 Checked cast from int8_t to uint16_t.
sapi_status_t sapi_cast_i8_to_u32 (int8_t in, uint32_t *out)
 Checked cast from int8_t to uint32_t.
sapi_status_t sapi_cast_i8_to_u64 (int8_t in, uint64_t *out)
 Checked cast from int8_t to uint64_t.
sapi_status_t sapi_cast_i8_to_size (int8_t in, size_t *out)
 Checked cast from int8_t to size_t.
sapi_status_t sapi_cast_i16_to_i8 (int16_t in, int8_t *out)
 Checked cast from int16_t to int8_t.
sapi_status_t sapi_cast_i16_to_i32 (int16_t in, int32_t *out)
 Checked cast from int16_t to int32_t.
sapi_status_t sapi_cast_i16_to_i64 (int16_t in, int64_t *out)
 Checked cast from int16_t to int64_t.
sapi_status_t sapi_cast_i16_to_u8 (int16_t in, uint8_t *out)
 Checked cast from int16_t to uint8_t.
sapi_status_t sapi_cast_i16_to_u16 (int16_t in, uint16_t *out)
 Checked cast from int16_t to uint16_t.
sapi_status_t sapi_cast_i16_to_u32 (int16_t in, uint32_t *out)
 Checked cast from int16_t to uint32_t.
sapi_status_t sapi_cast_i16_to_u64 (int16_t in, uint64_t *out)
 Checked cast from int16_t to uint64_t.
sapi_status_t sapi_cast_i16_to_size (int16_t in, size_t *out)
 Checked cast from int16_t to size_t.
sapi_status_t sapi_cast_i32_to_i8 (int32_t in, int8_t *out)
 Checked cast from int32_t to int8_t.
sapi_status_t sapi_cast_i32_to_i16 (int32_t in, int16_t *out)
 Checked cast from int32_t to int16_t.
sapi_status_t sapi_cast_i32_to_i64 (int32_t in, int64_t *out)
 Checked cast from int32_t to int64_t.
sapi_status_t sapi_cast_i32_to_u8 (int32_t in, uint8_t *out)
 Checked cast from int32_t to uint8_t.
sapi_status_t sapi_cast_i32_to_u16 (int32_t in, uint16_t *out)
 Checked cast from int32_t to uint16_t.
sapi_status_t sapi_cast_i32_to_u32 (int32_t in, uint32_t *out)
 Checked cast from int32_t to uint32_t.
sapi_status_t sapi_cast_i32_to_u64 (int32_t in, uint64_t *out)
 Checked cast from int32_t to uint64_t.
sapi_status_t sapi_cast_i32_to_size (int32_t in, size_t *out)
 Checked cast from int32_t to size_t.
sapi_status_t sapi_cast_i64_to_i8 (int64_t in, int8_t *out)
 Checked cast from int64_t to int8_t.
sapi_status_t sapi_cast_i64_to_i16 (int64_t in, int16_t *out)
 Checked cast from int64_t to int16_t.
sapi_status_t sapi_cast_i64_to_i32 (int64_t in, int32_t *out)
 Checked cast from int64_t to int32_t.
sapi_status_t sapi_cast_i64_to_u8 (int64_t in, uint8_t *out)
 Checked cast from int64_t to uint8_t.
sapi_status_t sapi_cast_i64_to_u16 (int64_t in, uint16_t *out)
 Checked cast from int64_t to uint16_t.
sapi_status_t sapi_cast_i64_to_u32 (int64_t in, uint32_t *out)
 Checked cast from int64_t to uint32_t.
sapi_status_t sapi_cast_i64_to_u64 (int64_t in, uint64_t *out)
 Checked cast from int64_t to uint64_t.
sapi_status_t sapi_cast_i64_to_size (int64_t in, size_t *out)
 Checked cast from int64_t to size_t.
sapi_status_t sapi_cast_u8_to_i8 (uint8_t in, int8_t *out)
 Checked cast from uint8_t to int8_t.
sapi_status_t sapi_cast_u8_to_i16 (uint8_t in, int16_t *out)
 Checked cast from uint8_t to int16_t.
sapi_status_t sapi_cast_u8_to_i32 (uint8_t in, int32_t *out)
 Checked cast from uint8_t to int32_t.
sapi_status_t sapi_cast_u8_to_i64 (uint8_t in, int64_t *out)
 Checked cast from uint8_t to int64_t.
sapi_status_t sapi_cast_u8_to_u16 (uint8_t in, uint16_t *out)
 Checked cast from uint8_t to uint16_t.
sapi_status_t sapi_cast_u8_to_u32 (uint8_t in, uint32_t *out)
 Checked cast from uint8_t to uint32_t.
sapi_status_t sapi_cast_u8_to_u64 (uint8_t in, uint64_t *out)
 Checked cast from uint8_t to uint64_t.
sapi_status_t sapi_cast_u8_to_size (uint8_t in, size_t *out)
 Checked cast from uint8_t to size_t.
sapi_status_t sapi_cast_u16_to_i8 (uint16_t in, int8_t *out)
 Checked cast from uint16_t to int8_t.
sapi_status_t sapi_cast_u16_to_i16 (uint16_t in, int16_t *out)
 Checked cast from uint16_t to int16_t.
sapi_status_t sapi_cast_u16_to_i32 (uint16_t in, int32_t *out)
 Checked cast from uint16_t to int32_t.
sapi_status_t sapi_cast_u16_to_i64 (uint16_t in, int64_t *out)
 Checked cast from uint16_t to int64_t.
sapi_status_t sapi_cast_u16_to_u8 (uint16_t in, uint8_t *out)
 Checked cast from uint16_t to uint8_t.
sapi_status_t sapi_cast_u16_to_u32 (uint16_t in, uint32_t *out)
 Checked cast from uint16_t to uint32_t.
sapi_status_t sapi_cast_u16_to_u64 (uint16_t in, uint64_t *out)
 Checked cast from uint16_t to uint64_t.
sapi_status_t sapi_cast_u16_to_size (uint16_t in, size_t *out)
 Checked cast from uint16_t to size_t.
sapi_status_t sapi_cast_u32_to_i8 (uint32_t in, int8_t *out)
 Checked cast from uint32_t to int8_t.
sapi_status_t sapi_cast_u32_to_i16 (uint32_t in, int16_t *out)
 Checked cast from uint32_t to int16_t.
sapi_status_t sapi_cast_u32_to_i32 (uint32_t in, int32_t *out)
 Checked cast from uint32_t to int32_t.
sapi_status_t sapi_cast_u32_to_i64 (uint32_t in, int64_t *out)
 Checked cast from uint32_t to int64_t.
sapi_status_t sapi_cast_u32_to_u8 (uint32_t in, uint8_t *out)
 Checked cast from uint32_t to uint8_t.
sapi_status_t sapi_cast_u32_to_u16 (uint32_t in, uint16_t *out)
 Checked cast from uint32_t to uint16_t.
sapi_status_t sapi_cast_u32_to_u64 (uint32_t in, uint64_t *out)
 Checked cast from uint32_t to uint64_t.
sapi_status_t sapi_cast_u32_to_size (uint32_t in, size_t *out)
 Checked cast from uint32_t to size_t.
sapi_status_t sapi_cast_u64_to_i8 (uint64_t in, int8_t *out)
 Checked cast from uint64_t to int8_t.
sapi_status_t sapi_cast_u64_to_i16 (uint64_t in, int16_t *out)
 Checked cast from uint64_t to int16_t.
sapi_status_t sapi_cast_u64_to_i32 (uint64_t in, int32_t *out)
 Checked cast from uint64_t to int32_t.
sapi_status_t sapi_cast_u64_to_i64 (uint64_t in, int64_t *out)
 Checked cast from uint64_t to int64_t.
sapi_status_t sapi_cast_u64_to_u8 (uint64_t in, uint8_t *out)
 Checked cast from uint64_t to uint8_t.
sapi_status_t sapi_cast_u64_to_u16 (uint64_t in, uint16_t *out)
 Checked cast from uint64_t to uint16_t.
sapi_status_t sapi_cast_u64_to_u32 (uint64_t in, uint32_t *out)
 Checked cast from uint64_t to uint32_t.
sapi_status_t sapi_cast_u64_to_size (uint64_t in, size_t *out)
 Checked cast from uint64_t to size_t.
sapi_status_t sapi_cast_size_to_i8 (size_t in, int8_t *out)
 Checked cast from size_t to int8_t.
sapi_status_t sapi_cast_size_to_i16 (size_t in, int16_t *out)
 Checked cast from size_t to int16_t.
sapi_status_t sapi_cast_size_to_i32 (size_t in, int32_t *out)
 Checked cast from size_t to int32_t.
sapi_status_t sapi_cast_size_to_i64 (size_t in, int64_t *out)
 Checked cast from size_t to int64_t.
sapi_status_t sapi_cast_size_to_u8 (size_t in, uint8_t *out)
 Checked cast from size_t to uint8_t.
sapi_status_t sapi_cast_size_to_u16 (size_t in, uint16_t *out)
 Checked cast from size_t to uint16_t.
sapi_status_t sapi_cast_size_to_u32 (size_t in, uint32_t *out)
 Checked cast from size_t to uint32_t.
sapi_status_t sapi_cast_size_to_u64 (size_t in, uint64_t *out)
 Checked cast from size_t to uint64_t.
sapi_status_t sapi_cast_checked_add_u32 (uint32_t a, uint32_t b, uint32_t *out)
 Checked addition: *out = a + b, only if the result fits uint32_t.
sapi_status_t sapi_cast_checked_sub_u32 (uint32_t a, uint32_t b, uint32_t *out)
 Checked subtraction: *out = a - b, only if b <= a (no underflow).
sapi_status_t sapi_cast_checked_mul_u32 (uint32_t a, uint32_t b, uint32_t *out)
 Checked multiplication: *out = a * b, only if the result fits uint32_t.
sapi_status_t sapi_cast_checked_add_size (size_t a, size_t b, size_t *out)
 Checked addition: *out = a + b, only if the result fits size_t.
sapi_status_t sapi_cast_checked_sub_size (size_t a, size_t b, size_t *out)
 Checked subtraction: *out = a - b, only if b <= a (no underflow).
sapi_status_t sapi_cast_checked_mul_size (size_t a, size_t b, size_t *out)
 Checked multiplication: *out = a * b, only if the result fits size_t.
sapi_status_t sapi_cast_bounds_check (size_t index, size_t count)
 Checked array/index bounds check: is index a valid index into an array of count elements?

Detailed Description

Bounds-checked conversion between fixed-width types (ADR-003).

Function Documentation

◆ sapi_cast_i8_to_i16()

sapi_status_t sapi_cast_i8_to_i16 ( int8_t in,
int16_t * out )

Checked cast from int8_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 13 of file sapi_cast.c.

◆ sapi_cast_i8_to_i32()

sapi_status_t sapi_cast_i8_to_i32 ( int8_t in,
int32_t * out )

Checked cast from int8_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 23 of file sapi_cast.c.

◆ sapi_cast_i8_to_i64()

sapi_status_t sapi_cast_i8_to_i64 ( int8_t in,
int64_t * out )

Checked cast from int8_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 33 of file sapi_cast.c.

◆ sapi_cast_i8_to_u8()

sapi_status_t sapi_cast_i8_to_u8 ( int8_t in,
uint8_t * out )

Checked cast from int8_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 43 of file sapi_cast.c.

◆ sapi_cast_i8_to_u16()

sapi_status_t sapi_cast_i8_to_u16 ( int8_t in,
uint16_t * out )

Checked cast from int8_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 58 of file sapi_cast.c.

◆ sapi_cast_i8_to_u32()

sapi_status_t sapi_cast_i8_to_u32 ( int8_t in,
uint32_t * out )

Checked cast from int8_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 73 of file sapi_cast.c.

◆ sapi_cast_i8_to_u64()

sapi_status_t sapi_cast_i8_to_u64 ( int8_t in,
uint64_t * out )

Checked cast from int8_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 88 of file sapi_cast.c.

◆ sapi_cast_i8_to_size()

sapi_status_t sapi_cast_i8_to_size ( int8_t in,
size_t * out )

Checked cast from int8_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 103 of file sapi_cast.c.

◆ sapi_cast_i16_to_i8()

sapi_status_t sapi_cast_i16_to_i8 ( int16_t in,
int8_t * out )

Checked cast from int16_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 124 of file sapi_cast.c.

◆ sapi_cast_i16_to_i32()

sapi_status_t sapi_cast_i16_to_i32 ( int16_t in,
int32_t * out )

Checked cast from int16_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 143 of file sapi_cast.c.

◆ sapi_cast_i16_to_i64()

sapi_status_t sapi_cast_i16_to_i64 ( int16_t in,
int64_t * out )

Checked cast from int16_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 153 of file sapi_cast.c.

◆ sapi_cast_i16_to_u8()

sapi_status_t sapi_cast_i16_to_u8 ( int16_t in,
uint8_t * out )

Checked cast from int16_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 163 of file sapi_cast.c.

◆ sapi_cast_i16_to_u16()

sapi_status_t sapi_cast_i16_to_u16 ( int16_t in,
uint16_t * out )

Checked cast from int16_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 182 of file sapi_cast.c.

◆ sapi_cast_i16_to_u32()

sapi_status_t sapi_cast_i16_to_u32 ( int16_t in,
uint32_t * out )

Checked cast from int16_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 197 of file sapi_cast.c.

◆ sapi_cast_i16_to_u64()

sapi_status_t sapi_cast_i16_to_u64 ( int16_t in,
uint64_t * out )

Checked cast from int16_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 212 of file sapi_cast.c.

◆ sapi_cast_i16_to_size()

sapi_status_t sapi_cast_i16_to_size ( int16_t in,
size_t * out )

Checked cast from int16_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 227 of file sapi_cast.c.

◆ sapi_cast_i32_to_i8()

sapi_status_t sapi_cast_i32_to_i8 ( int32_t in,
int8_t * out )

Checked cast from int32_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 248 of file sapi_cast.c.

◆ sapi_cast_i32_to_i16()

sapi_status_t sapi_cast_i32_to_i16 ( int32_t in,
int16_t * out )

Checked cast from int32_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 267 of file sapi_cast.c.

◆ sapi_cast_i32_to_i64()

sapi_status_t sapi_cast_i32_to_i64 ( int32_t in,
int64_t * out )

Checked cast from int32_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 286 of file sapi_cast.c.

◆ sapi_cast_i32_to_u8()

sapi_status_t sapi_cast_i32_to_u8 ( int32_t in,
uint8_t * out )

Checked cast from int32_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 296 of file sapi_cast.c.

◆ sapi_cast_i32_to_u16()

sapi_status_t sapi_cast_i32_to_u16 ( int32_t in,
uint16_t * out )

Checked cast from int32_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 315 of file sapi_cast.c.

◆ sapi_cast_i32_to_u32()

sapi_status_t sapi_cast_i32_to_u32 ( int32_t in,
uint32_t * out )

Checked cast from int32_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 334 of file sapi_cast.c.

◆ sapi_cast_i32_to_u64()

sapi_status_t sapi_cast_i32_to_u64 ( int32_t in,
uint64_t * out )

Checked cast from int32_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 349 of file sapi_cast.c.

◆ sapi_cast_i32_to_size()

sapi_status_t sapi_cast_i32_to_size ( int32_t in,
size_t * out )

Checked cast from int32_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 364 of file sapi_cast.c.

◆ sapi_cast_i64_to_i8()

sapi_status_t sapi_cast_i64_to_i8 ( int64_t in,
int8_t * out )

Checked cast from int64_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 385 of file sapi_cast.c.

◆ sapi_cast_i64_to_i16()

sapi_status_t sapi_cast_i64_to_i16 ( int64_t in,
int16_t * out )

Checked cast from int64_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 404 of file sapi_cast.c.

◆ sapi_cast_i64_to_i32()

sapi_status_t sapi_cast_i64_to_i32 ( int64_t in,
int32_t * out )

Checked cast from int64_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 423 of file sapi_cast.c.

◆ sapi_cast_i64_to_u8()

sapi_status_t sapi_cast_i64_to_u8 ( int64_t in,
uint8_t * out )

Checked cast from int64_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 442 of file sapi_cast.c.

◆ sapi_cast_i64_to_u16()

sapi_status_t sapi_cast_i64_to_u16 ( int64_t in,
uint16_t * out )

Checked cast from int64_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 461 of file sapi_cast.c.

◆ sapi_cast_i64_to_u32()

sapi_status_t sapi_cast_i64_to_u32 ( int64_t in,
uint32_t * out )

Checked cast from int64_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 480 of file sapi_cast.c.

◆ sapi_cast_i64_to_u64()

sapi_status_t sapi_cast_i64_to_u64 ( int64_t in,
uint64_t * out )

Checked cast from int64_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 499 of file sapi_cast.c.

◆ sapi_cast_i64_to_size()

sapi_status_t sapi_cast_i64_to_size ( int64_t in,
size_t * out )

Checked cast from int64_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 514 of file sapi_cast.c.

◆ sapi_cast_u8_to_i8()

sapi_status_t sapi_cast_u8_to_i8 ( uint8_t in,
int8_t * out )

Checked cast from uint8_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 535 of file sapi_cast.c.

◆ sapi_cast_u8_to_i16()

sapi_status_t sapi_cast_u8_to_i16 ( uint8_t in,
int16_t * out )

Checked cast from uint8_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 550 of file sapi_cast.c.

◆ sapi_cast_u8_to_i32()

sapi_status_t sapi_cast_u8_to_i32 ( uint8_t in,
int32_t * out )

Checked cast from uint8_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 560 of file sapi_cast.c.

◆ sapi_cast_u8_to_i64()

sapi_status_t sapi_cast_u8_to_i64 ( uint8_t in,
int64_t * out )

Checked cast from uint8_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 570 of file sapi_cast.c.

◆ sapi_cast_u8_to_u16()

sapi_status_t sapi_cast_u8_to_u16 ( uint8_t in,
uint16_t * out )

Checked cast from uint8_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 580 of file sapi_cast.c.

◆ sapi_cast_u8_to_u32()

sapi_status_t sapi_cast_u8_to_u32 ( uint8_t in,
uint32_t * out )

Checked cast from uint8_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 590 of file sapi_cast.c.

◆ sapi_cast_u8_to_u64()

sapi_status_t sapi_cast_u8_to_u64 ( uint8_t in,
uint64_t * out )

Checked cast from uint8_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 600 of file sapi_cast.c.

◆ sapi_cast_u8_to_size()

sapi_status_t sapi_cast_u8_to_size ( uint8_t in,
size_t * out )

Checked cast from uint8_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 610 of file sapi_cast.c.

◆ sapi_cast_u16_to_i8()

sapi_status_t sapi_cast_u16_to_i8 ( uint16_t in,
int8_t * out )

Checked cast from uint16_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 629 of file sapi_cast.c.

◆ sapi_cast_u16_to_i16()

sapi_status_t sapi_cast_u16_to_i16 ( uint16_t in,
int16_t * out )

Checked cast from uint16_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 644 of file sapi_cast.c.

◆ sapi_cast_u16_to_i32()

sapi_status_t sapi_cast_u16_to_i32 ( uint16_t in,
int32_t * out )

Checked cast from uint16_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 659 of file sapi_cast.c.

◆ sapi_cast_u16_to_i64()

sapi_status_t sapi_cast_u16_to_i64 ( uint16_t in,
int64_t * out )

Checked cast from uint16_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 669 of file sapi_cast.c.

◆ sapi_cast_u16_to_u8()

sapi_status_t sapi_cast_u16_to_u8 ( uint16_t in,
uint8_t * out )

Checked cast from uint16_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 679 of file sapi_cast.c.

◆ sapi_cast_u16_to_u32()

sapi_status_t sapi_cast_u16_to_u32 ( uint16_t in,
uint32_t * out )

Checked cast from uint16_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 694 of file sapi_cast.c.

◆ sapi_cast_u16_to_u64()

sapi_status_t sapi_cast_u16_to_u64 ( uint16_t in,
uint64_t * out )

Checked cast from uint16_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 704 of file sapi_cast.c.

◆ sapi_cast_u16_to_size()

sapi_status_t sapi_cast_u16_to_size ( uint16_t in,
size_t * out )

Checked cast from uint16_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 714 of file sapi_cast.c.

◆ sapi_cast_u32_to_i8()

sapi_status_t sapi_cast_u32_to_i8 ( uint32_t in,
int8_t * out )

Checked cast from uint32_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 733 of file sapi_cast.c.

◆ sapi_cast_u32_to_i16()

sapi_status_t sapi_cast_u32_to_i16 ( uint32_t in,
int16_t * out )

Checked cast from uint32_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 748 of file sapi_cast.c.

◆ sapi_cast_u32_to_i32()

sapi_status_t sapi_cast_u32_to_i32 ( uint32_t in,
int32_t * out )

Checked cast from uint32_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 763 of file sapi_cast.c.

◆ sapi_cast_u32_to_i64()

sapi_status_t sapi_cast_u32_to_i64 ( uint32_t in,
int64_t * out )

Checked cast from uint32_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 778 of file sapi_cast.c.

◆ sapi_cast_u32_to_u8()

sapi_status_t sapi_cast_u32_to_u8 ( uint32_t in,
uint8_t * out )

Checked cast from uint32_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 788 of file sapi_cast.c.

◆ sapi_cast_u32_to_u16()

sapi_status_t sapi_cast_u32_to_u16 ( uint32_t in,
uint16_t * out )

Checked cast from uint32_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 803 of file sapi_cast.c.

◆ sapi_cast_u32_to_u64()

sapi_status_t sapi_cast_u32_to_u64 ( uint32_t in,
uint64_t * out )

Checked cast from uint32_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 818 of file sapi_cast.c.

◆ sapi_cast_u32_to_size()

sapi_status_t sapi_cast_u32_to_size ( uint32_t in,
size_t * out )

Checked cast from uint32_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 828 of file sapi_cast.c.

◆ sapi_cast_u64_to_i8()

sapi_status_t sapi_cast_u64_to_i8 ( uint64_t in,
int8_t * out )

Checked cast from uint64_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 847 of file sapi_cast.c.

◆ sapi_cast_u64_to_i16()

sapi_status_t sapi_cast_u64_to_i16 ( uint64_t in,
int16_t * out )

Checked cast from uint64_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 862 of file sapi_cast.c.

◆ sapi_cast_u64_to_i32()

sapi_status_t sapi_cast_u64_to_i32 ( uint64_t in,
int32_t * out )

Checked cast from uint64_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 877 of file sapi_cast.c.

◆ sapi_cast_u64_to_i64()

sapi_status_t sapi_cast_u64_to_i64 ( uint64_t in,
int64_t * out )

Checked cast from uint64_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 892 of file sapi_cast.c.

◆ sapi_cast_u64_to_u8()

sapi_status_t sapi_cast_u64_to_u8 ( uint64_t in,
uint8_t * out )

Checked cast from uint64_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 907 of file sapi_cast.c.

◆ sapi_cast_u64_to_u16()

sapi_status_t sapi_cast_u64_to_u16 ( uint64_t in,
uint16_t * out )

Checked cast from uint64_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 922 of file sapi_cast.c.

◆ sapi_cast_u64_to_u32()

sapi_status_t sapi_cast_u64_to_u32 ( uint64_t in,
uint32_t * out )

Checked cast from uint64_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 937 of file sapi_cast.c.

◆ sapi_cast_u64_to_size()

sapi_status_t sapi_cast_u64_to_size ( uint64_t in,
size_t * out )

Checked cast from uint64_t to size_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit size_t (REQ-COMMON-CAST-003).

Definition at line 952 of file sapi_cast.c.

◆ sapi_cast_size_to_i8()

sapi_status_t sapi_cast_size_to_i8 ( size_t in,
int8_t * out )

Checked cast from size_t to int8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int8_t (REQ-COMMON-CAST-003).

Definition at line 971 of file sapi_cast.c.

◆ sapi_cast_size_to_i16()

sapi_status_t sapi_cast_size_to_i16 ( size_t in,
int16_t * out )

Checked cast from size_t to int16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int16_t (REQ-COMMON-CAST-003).

Definition at line 987 of file sapi_cast.c.

◆ sapi_cast_size_to_i32()

sapi_status_t sapi_cast_size_to_i32 ( size_t in,
int32_t * out )

Checked cast from size_t to int32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int32_t (REQ-COMMON-CAST-003).

Definition at line 1003 of file sapi_cast.c.

◆ sapi_cast_size_to_i64()

sapi_status_t sapi_cast_size_to_i64 ( size_t in,
int64_t * out )

Checked cast from size_t to int64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit int64_t (REQ-COMMON-CAST-003).

Definition at line 1019 of file sapi_cast.c.

◆ sapi_cast_size_to_u8()

sapi_status_t sapi_cast_size_to_u8 ( size_t in,
uint8_t * out )

Checked cast from size_t to uint8_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint8_t (REQ-COMMON-CAST-003).

Definition at line 1035 of file sapi_cast.c.

◆ sapi_cast_size_to_u16()

sapi_status_t sapi_cast_size_to_u16 ( size_t in,
uint16_t * out )

Checked cast from size_t to uint16_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint16_t (REQ-COMMON-CAST-003).

Definition at line 1051 of file sapi_cast.c.

◆ sapi_cast_size_to_u32()

sapi_status_t sapi_cast_size_to_u32 ( size_t in,
uint32_t * out )

Checked cast from size_t to uint32_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint32_t (REQ-COMMON-CAST-003).

Definition at line 1067 of file sapi_cast.c.

◆ sapi_cast_size_to_u64()

sapi_status_t sapi_cast_size_to_u64 ( size_t in,
uint64_t * out )

Checked cast from size_t to uint64_t.

Parameters
inValue to convert.
outReceives the converted value on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL (REQ-COMMON-CAST-002); SAPI_STATUS_VALUE_OUT_OF_RANGE if in does not fit uint64_t (REQ-COMMON-CAST-003).

Definition at line 1083 of file sapi_cast.c.

◆ sapi_cast_checked_add_u32()

sapi_status_t sapi_cast_checked_add_u32 ( uint32_t a,
uint32_t b,
uint32_t * out )

Checked addition: *out = a + b, only if the result fits uint32_t.

Parameters
a,bOperands.
outReceives a + b on success; left untouched on failure (REQ-COMMON-CAST-001). Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if a + b overflows uint32_t (REQ-COMMON-CAST-004).

Definition at line 1094 of file sapi_cast.c.

◆ sapi_cast_checked_sub_u32()

sapi_status_t sapi_cast_checked_sub_u32 ( uint32_t a,
uint32_t b,
uint32_t * out )

Checked subtraction: *out = a - b, only if b <= a (no underflow).

Parameters
a,bOperands.
outReceives a - b on success; left untouched on failure. Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if b > a (REQ-COMMON-CAST-004).

Definition at line 1115 of file sapi_cast.c.

◆ sapi_cast_checked_mul_u32()

sapi_status_t sapi_cast_checked_mul_u32 ( uint32_t a,
uint32_t b,
uint32_t * out )

Checked multiplication: *out = a * b, only if the result fits uint32_t.

Parameters
a,bOperands.
outReceives a * b on success; left untouched on failure. Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if a * b overflows uint32_t (REQ-COMMON-CAST-004).

Definition at line 1131 of file sapi_cast.c.

◆ sapi_cast_checked_add_size()

sapi_status_t sapi_cast_checked_add_size ( size_t a,
size_t b,
size_t * out )

Checked addition: *out = a + b, only if the result fits size_t.

Parameters
a,bOperands.
outReceives a + b on success; left untouched on failure. Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if a + b overflows size_t (REQ-COMMON-CAST-004).

Definition at line 1148 of file sapi_cast.c.

◆ sapi_cast_checked_sub_size()

sapi_status_t sapi_cast_checked_sub_size ( size_t a,
size_t b,
size_t * out )

Checked subtraction: *out = a - b, only if b <= a (no underflow).

Parameters
a,bOperands.
outReceives a - b on success; left untouched on failure. Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if b > a (REQ-COMMON-CAST-004).

Definition at line 1167 of file sapi_cast.c.

◆ sapi_cast_checked_mul_size()

sapi_status_t sapi_cast_checked_mul_size ( size_t a,
size_t b,
size_t * out )

Checked multiplication: *out = a * b, only if the result fits size_t.

Parameters
a,bOperands.
outReceives a * b on success; left untouched on failure. Must not be NULL.
Returns
SAPI_STATUS_OK on success; SAPI_STATUS_INVALID_PARAM if out is NULL; SAPI_STATUS_VALUE_OUT_OF_RANGE if a * b overflows size_t (REQ-COMMON-CAST-004).

Definition at line 1183 of file sapi_cast.c.

◆ sapi_cast_bounds_check()

sapi_status_t sapi_cast_bounds_check ( size_t index,
size_t count )

Checked array/index bounds check: is index a valid index into an array of count elements?

Parameters
indexCandidate index.
countNumber of elements in the array (a count of 0 means no index is ever valid).
Returns
SAPI_STATUS_OK if index < count; SAPI_STATUS_VALUE_OUT_OF_RANGE otherwise (REQ-COMMON-CAST-005). Never SAPI_STATUS_INVALID_PARAM - both parameters are plain values, not pointers, so there is nothing to NULL-check.

Definition at line 1199 of file sapi_cast.c.