Scroll to navigation

SDL_size_mul_overflow(3) SDL3 FUNCTIONS SDL_size_mul_overflow(3)

NAME

SDL_size_mul_overflow - Multiply two integers, checking for overflow.

HEADER FILE

Defined in SDL3/SDL_stdinc.h

SYNOPSIS

#include "SDL3/SDL.h"
SDL_FORCE_INLINE int SDL_size_mul_overflow (size_t a, size_t b, size_t *ret);

DESCRIPTION

If a b would overflow, return -1.

Otherwise store a b via ret and return 0.

FUNCTION PARAMETERS

the multiplicand.
the multiplier.
on non-overflow output, stores the multiplication result. May not be NULL.

RETURN VALUE

Returns -1 on overflow, 0 if result doesn't overflow.

THREAD SAFETY

It is safe to call this function from any thread.

AVAILABILITY

This function is available since SDL 3.0.0.

SDL 3.1.2 Simple Directmedia Layer