Files
RedBear-OS/recipes/libs/glib/source/docs/reference/glib/checked-math.md
T
vasilito facf0c92e0 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

903 B

Title: Bounds-checking Integer Arithmetic SPDX-License-Identifier: LGPL-2.1-or-later SPDX-FileCopyrightText: 2015 Allison Lortie

Bounds-checking Integer Arithmetic

GLib offers a set of macros for doing additions and multiplications of unsigned integers, with checks for overflows.

The helpers all have three arguments. A pointer to the destination is always the first argument and the operands to the operation are the other two.

Following standard GLib convention, the helpers return true in case of success (ie: no overflow).

The helpers may be macros, normal functions or inlines. They may be implemented with inline assembly or compiler intrinsics where available.

Since: 2.48

The APIs are:

  • [func@GLib.uint_checked_add]
  • [func@GLib.uint_checked_mul]
  • [func@GLib.uint64_checked_add]
  • [func@GLib.uint64_checked_mul]
  • [func@GLib.size_checked_add]
  • [func@GLib.size_checked_mul]