跳转至

Graphics Utility Helpers

Utility macros and functions for graphics operations. More...

Functions

Name
int32_t clamp_i32(int32_t v, int32_t lo, int32_t hi)

Defines

Name
MAX(a, b)
Return the maximum of two values.
MIN(a, b)
Return the minimum of two values.

Detailed Description

Utility macros and functions for graphics operations.

This module provides commonly used utility macros and inline functions to simplify graphics programming and reduce code duplication. These utilities cover common operations like value comparison, clamping, and boundary checking.

Includes:

  • MIN/MAX macros for value comparison
  • Clamping function for range constraint
  • Additional graphics-specific helpers

Functions Documentation

function clamp_i32

static inline int32_t clamp_i32(
    int32_t v,
    int32_t lo,
    int32_t hi
)

Macros Documentation

define MAX

#define MAX(
    a,
    b
)
((a) > (b) ? (a) : (b))

Return the maximum of two values.

Parameters:

  • a First value to compare.
  • b Second value to compare.

Return: The maximum value.

Note: Only defined if not already defined elsewhere.

Evaluates to the greater of the two arguments. Arguments are evaluated only once when possible.

define MIN

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

Return the minimum of two values.

Parameters:

  • a First value to compare.
  • b Second value to compare.

Return: The minimum value.

Note: Only defined if not already defined elsewhere.

Evaluates to the lesser of the two arguments. Arguments are evaluated only once when possible.


Updated on 2026-02-03 at 13:21:55 +0000