FLINT3.7.0-dev

_addcarry_ulong, _subborrow_ulong

Synopsis#include <flint/crt_helpers.h>
unsigned char _addcarry_ulong(unsigned char cf, ulong x, ulong y, ulong * s)source
unsigned char _subborrow_ulong(unsigned char cf, ulong x, ulong y, ulong * s)source

Set *s to x + y + c (respectively x - y - c) modulo B for the carry (borrow) c \in \{0, 1\} and return the carry (borrow) out. With AVX2 on 64-bit machines these are the compiler intrinsics _addcarry_u64 and _subborrow_u64; otherwise they are written with the two-limb macros of longlong.h.

Cite this page

The FLINT team, “_addcarry_ulong, _subborrow_ulong (crt_helpers.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/crt_helpers/_addcarry_ulong.html (generated 2026-10-20).