|
BEEP-8 Helper Lib 1.0.0
|
Module for performing forced type casts between different data types. More...
#include <b8/type.h>Go to the source code of this file.
Module for performing forced type casts between different data types.
This module provides functions for forced type casting, enabling conversions between various data types such as pointers and integers. It is primarily used for scenarios where normal casting is not feasible or safe, offering utility functions to handle these conversions.
u32.u32 value to u8* pointer.u8* pointer to u32.char* pointer to u32.u32* pointer to u32.s16 value to u32.u32 value to s16.u32 value to s32.This module uses unions internally to reinterpret data between different types. Unions allow the same memory space to be treated as different types.
u32, u32*, u8*, char*, s32, and void*.u16 and s16.All conversion functions call the SAFE_ASSERT function at the beginning to ensure that the size of a pointer is 4 bytes, guaranteeing that the target system is a 32-bit environment.
Here is an example of how to use this module:
This example demonstrates the conversion of void* to u32, u32 to u8*, and s16 to u32, showcasing how to use the provided utility functions for safe type conversions.