std1.0.0-beta-7 SafeC docs

Module stdckdint

#include <std/stdckdint.h> source

Checked integer arithmetic (C23 <stdckdint.h>) Each function performs op(a, b), stores the wrapped result in *result, and returns 1 if the mathematical result overflowed, 0 otherwise. This is the SafeC equivalent of C23's type-generic ckd_add/ckd_sub/ckd_mul.

Functions

ckd_add_i32
ckd_sub_i32
ckd_mul_i32
ckd_add_i64
ckd_sub_i64
ckd_mul_i64
ckd_add_u32
ckd_sub_u32
ckd_mul_u32
ckd_add_u64
ckd_sub_u64
ckd_mul_u64

Macros

CKD_OKCKD_OK: operation succeeded with no overflow.
CKD_OVERFLOWCKD_OVERFLOW: mathematical result overflowed; wrapped value is stored.