SH4ZAM! 0.7.0
Fast math library for the Sega Dreamcast's SH4 CPU
Loading...
Searching...
No Matches
shz_version.h
Go to the documentation of this file.
1/*! \file
2 * \brief Compile-Time API Versioning
3 *
4 * This file provides the utility macros and constants needed for implementing
5 * compile/link-time version checking of the SH4ZAM library.
6 *
7 * \author 2026 Falco Girgis
8 * \copyright MIT License
9 */
10
11#ifndef SHZ_VERSION_H
12#define SHZ_VERSION_H
13
14#include <stdint.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/*! \name Compile-Time Utilities
21 \brief Constants and methods for checking the compile-time SH4ZAM version.
22 @{
23*/
24
25#define SHZ_VERSION_MAJOR 0 //!< Compile-time SH4ZAM major version.
26#define SHZ_VERSION_MINOR 7 //!< Compile-time SH4ZAM minor version.
27#define SHZ_VERSION_PATCH 0 //!< Compile-time Sh4ZAM patch version.
28
29//! Current SH4ZAM full compile-time version identifier, integer-compatible.
32
33/*! Packs values of individual version components into a SH4ZAM full version value.
34
35 Combines values from individual version components into a single unsigned 32-bit
36 integer which can be compared to other version values for equality or inequality.
37
38 \param major Unsigned 8-bit field representing major version value.
39 \param minor Unsigned 16-bit field representing minor version value.
40 \param patch Unsigned 8-bit field representing patch version value.
41
42 \returns Unsigned 32-bit value representing the full version value.
43*/
44#define SHZ_VERSION_INIT(major, minor, patch)
45 ((((major) & 0xff) << 24) | (((minor) & 0xffff) << 8) | (((patch) & 0xff)))
46
47//! @}
48
49/*! \name Link-Time Utilities
50 \brief Methods for checking the link-time SH4ZAM version.
51 @{
52*/
53
54//! Integer-compatible value type containing a full SH4ZAM version.
55typedef uint32_t shz_version_t;
56
57//! Version typedef for those who hate POSIX-style.
59
60//! Returns the full version of SH4ZAM that was linked against.
62
63//! Extracts the individual version component values from a full version.
64void shz_version_fields(shz_version_t version, uint8_t* major, uint16_t* minor, uint8_t* patch);
65
66//! @}
67
68#ifdef __cplusplus
69}
70#endif
71
72#endif
#define SHZ_VERSION_PATCH
Compile-time Sh4ZAM patch version.
Definition shz_version.h:27
void shz_version_fields(shz_version_t version, uint8_t *major, uint16_t *minor, uint8_t *patch)
Extracts the individual version component values from a full version.
#define SHZ_VERSION_MINOR
Compile-time SH4ZAM minor version.
Definition shz_version.h:26
#define SHZ_VERSION_MAJOR
Compile-time SH4ZAM major version.
Definition shz_version.h:25
#define SHZ_VERSION_INIT(major, minor, patch)
Packs values of individual version components into a SH4ZAM full version value.
Definition shz_version.h:44
shz_version_t shz_version
Version typedef for those who hate POSIX-style.
Definition shz_version.h:58
shz_version_t shz_version_linked(void)
Returns the full version of SH4ZAM that was linked against.
uint32_t shz_version_t
Integer-compatible value type containing a full SH4ZAM version.
Definition shz_version.h:55