aboutsummaryrefslogblamecommitdiffstats
path: root/libpatch_get_zu__.c
blob: 050f3d2c0a7456c2a7780de7e093d5ec4fede2d3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                            
/* See LICENSE file for copyright and license details. */
#include "common.h"


size_t
libpatch_get_zu__(const char *text, size_t len, size_t *out)
{
	size_t i = 0, digit;
	*out = 0;
	for (; i < len; i++) {
		digit = (size_t)(text[i] - '0');
		if (digit > 9U)
			break;
		*out = *out * 10U + digit;
	}
	return i;
}