FLINT3.7.0-dev

mpn_ctx_fit_buffer_reserve, mpn_ctx_fit_buffer_release

Synopsis#include <flint/fft_small.h>
void * mpn_ctx_fit_buffer_reserve(mpn_ctx_t R, ulong head, ulong tail)source
void mpn_ctx_fit_buffer_release(mpn_ctx_t R)source

Reserves the tail of the scratch buffer: the buffer is grown to hold head plus tail bytes (each rounded up to 4096), and the returned pointer to the last tail bytes stays valid until the release. Returns NULL if a reservation is already live. Reserving, like any growth, invalidates a pointer returned by mpn_ctx_fit_buffer.

A reservation is meant for a caller that keeps transformed operands alive across many operations on one thread, such as an operand pool (fft_small_op_pool_fit with FFT_SMALL_OP_POOL_RESERVE) and through it the transformed integer rings of gr. While it is live, multiplications on the same thread still work: requests that do not fit in the head are served from the secondary buffer, at the cost of an allocation.

Cite this page

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