glfw
This commit is contained in:
@ -97,6 +97,19 @@ void assertTrueImplement(
|
||||
(value & flag) == flag, __VA_ARGS__ \
|
||||
)
|
||||
|
||||
/**
|
||||
* Asserts that the given string is not null, and has a length that is less
|
||||
* the maximum buffer size, including the NULL terminator.
|
||||
*
|
||||
* @param str String to check.
|
||||
* @param bufferSize Maximum buffer size.
|
||||
* @param message Message (sprintf format) to send to the logger.
|
||||
* @param args Optional TParam args for the sprintf message to accept.
|
||||
*/
|
||||
#define assertStringValid(str, bufferSize, ...) assertTrue( \
|
||||
((str != NULL) && ((strlen(str)+1) < bufferSize)), __VA_ARGS__ \
|
||||
)
|
||||
|
||||
/**
|
||||
* Asserts that the current code is deprecated and should not be used anymore.
|
||||
* @deprecated
|
||||
|
@ -18,4 +18,5 @@
|
||||
|
||||
typedef bool bool_t;
|
||||
typedef char char_t;
|
||||
typedef unsigned char uchar_t;
|
||||
typedef unsigned char uchar_t;
|
||||
typedef uint_fast32_t flag_t;
|
37
src/dawn/util/math.h
Normal file
37
src/dawn/util/math.h
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2023 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dawn.h"
|
||||
|
||||
/**
|
||||
* Returns the minimum of two values.
|
||||
*
|
||||
* @param a First value.
|
||||
* @param b Second value.
|
||||
* @return The minimum of the two values.
|
||||
*/
|
||||
#define mathMin(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
/**
|
||||
* Returns the maximum of two values.
|
||||
*
|
||||
* @param a First value.
|
||||
* @param b Second value.
|
||||
* @return The maximum of the two values.
|
||||
*/
|
||||
#define mathMax(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
/**
|
||||
* Clamps a value between two values.
|
||||
*
|
||||
* @param x Value to clamp.
|
||||
* @param a Minimum value.
|
||||
* @param b Maximum value.
|
||||
* @return The clamped value.
|
||||
*/
|
||||
#define mathClamp(x, a, b) mathMin(mathMax(x, a), b)
|
Reference in New Issue
Block a user