Skip to content

gtypes: Rework checked arithmetic handling

Philip Withnall requested to merge pwithnall/glib:2523-checked-arithmetic into main

Rather than using the fixed-type compiler builtins (__builtin_uadd_overflow(), etc.), use the generic versions (__builtin_add_overflow()). This avoids issues with matching the definition of GLib types (such as guint and particularly gsize) to basic C types (int, long, long long), as the mapping can vary between platforms.

Adjust the fallback inline functions similarly.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Fixes: #2523 (closed)

Closes #2523 (closed)

Edited by Philip Withnall

Merge request reports