GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
wide-int Performance Win

wide-int: Use return 1 instead of return len.

Optimizes wide-integer canonization by returning a constant 1, potentially speeding up C++ optimizers.

This commit simplifies the canonize function in wide-int.cc by directly returning 1 instead of the variable len. Since len is known to be 1 in this context, this change is a minor optimization that can contribute to faster C++ compilation times by removing a redundant variable lookup.

In Details

In the wide-int library, the canonize function was observed to always have len equal to 1 in a specific code path. This commit replaces return len; with return 1; to eliminate a redundant variable read, offering a micro-optimization that may benefit C++ frontends that heavily utilize the wide-int library for arbitrary-precision arithmetic, particularly during optimization phases.

For Context
wide-int
GCC's internal library for handling arbitrary-precision integers, used for representing values that exceed standard integer types during compilation.
canonize
A function within the wide-int library that normalizes or simplifies an arbitrary-precision integer representation. In this context, it likely ensures a canonical form for integers of a specific size.
Filed Under: optimizationwide-intC++