1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

seq: Update doc for fast_inc

This commit is contained in:
Nicolas Boichat 2025-04-04 18:04:33 +02:00
parent c311e208ae
commit 03b2cab650

View file

@ -259,10 +259,16 @@ pub fn uu_app() -> Command {
)
}
// Fast code path increment function.
// Add inc to the string val[start..end]. This operates on ASCII digits, assuming
// val and inc are well formed.
// Returns the new value for start.
/// Fast code path increment function.
///
/// Add inc to the string val[start..end]. This operates on ASCII digits, assuming
/// val and inc are well formed.
///
/// Returns the new value for start (can be less that the original value if we
/// have a carry or if inc > start).
///
/// We also assume that there is enough space in val to expand if start needs
/// to be updated.
fn fast_inc(val: &mut [u8], start: usize, end: usize, inc: &[u8]) -> usize {
// To avoid a lot of casts to signed integers, we make sure to decrement pos
// as late as possible, so that it does not ever go negative.