feat(headers): stddef/stdint/stdbool/limits/float/assert + features wiring
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#ifndef VLIBC_STDCKDINT_H
|
||||
#define VLIBC_STDCKDINT_H
|
||||
|
||||
/*
|
||||
* vlibc — <stdckdint.h>.
|
||||
*
|
||||
* Checked integer arithmetic (C23). Each macro computes the operation and
|
||||
* stores the result through *result; it returns true when the mathematical
|
||||
* result is not representable in the result type, in which case *result is
|
||||
* left unmodified. The implementation defers to the GCC
|
||||
* __builtin_*_overflow family, which is type-generic across every integer
|
||||
* type, matching the standard's semantics.
|
||||
*
|
||||
* This header is ISO C core and is present in every profile.
|
||||
*/
|
||||
|
||||
#include <vlibc/features.h>
|
||||
|
||||
#define ckd_add(result, a, b) __builtin_add_overflow((a), (b), (result))
|
||||
#define ckd_sub(result, a, b) __builtin_sub_overflow((a), (b), (result))
|
||||
#define ckd_mul(result, a, b) __builtin_mul_overflow((a), (b), (result))
|
||||
|
||||
#endif /* VLIBC_STDCKDINT_H */
|
||||
Reference in New Issue
Block a user